diff --git a/src/AbstractProcess.php b/src/AbstractProcess.php index 8b34777..866ce8a 100644 --- a/src/AbstractProcess.php +++ b/src/AbstractProcess.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process; use Hyperf\Contract\ProcessInterface; @@ -28,6 +29,7 @@ use Hyperf\Process\Exception\SocketAcceptException; use Psr\Container\ContainerInterface; use Psr\EventDispatcher\EventDispatcherInterface; +use Swoole\Coroutine\Socket; use Swoole\Event; use Swoole\Process as SwooleProcess; use Swoole\Server; @@ -156,7 +158,7 @@ protected function listen(Channel $quit) Coroutine::create(function () use ($quit) { while ($quit->pop(0.001) !== true) { try { - /** @var \Swoole\Coroutine\Socket $sock */ + /** @var Socket $sock */ $sock = $this->process->exportSocket(); $recv = $sock->recv($this->recvLength, $this->recvTimeout); if ($recv === '') { diff --git a/src/Annotation/Process.php b/src/Annotation/Process.php index 58571d9..36767fa 100644 --- a/src/Annotation/Process.php +++ b/src/Annotation/Process.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Annotation; use Attribute; diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index f7b651f..6a96b57 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process; use Hyperf\Process\Listener\BootProcessListener; diff --git a/src/Event/AfterCoroutineHandle.php b/src/Event/AfterCoroutineHandle.php index 6723015..9e86b4f 100644 --- a/src/Event/AfterCoroutineHandle.php +++ b/src/Event/AfterCoroutineHandle.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Event; use Hyperf\Process\AbstractProcess; diff --git a/src/Event/AfterProcessHandle.php b/src/Event/AfterProcessHandle.php index 93f3b6d..ff87c4a 100644 --- a/src/Event/AfterProcessHandle.php +++ b/src/Event/AfterProcessHandle.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Event; use Hyperf\Process\AbstractProcess; diff --git a/src/Event/BeforeCoroutineHandle.php b/src/Event/BeforeCoroutineHandle.php index 5912a09..c9b6dd1 100644 --- a/src/Event/BeforeCoroutineHandle.php +++ b/src/Event/BeforeCoroutineHandle.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Event; use Hyperf\Process\AbstractProcess; diff --git a/src/Event/BeforeProcessHandle.php b/src/Event/BeforeProcessHandle.php index 6cc4f2f..145fa5a 100644 --- a/src/Event/BeforeProcessHandle.php +++ b/src/Event/BeforeProcessHandle.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Event; use Hyperf\Process\AbstractProcess; diff --git a/src/Event/PipeMessage.php b/src/Event/PipeMessage.php index 9be2341..85796a6 100644 --- a/src/Event/PipeMessage.php +++ b/src/Event/PipeMessage.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Event; class PipeMessage diff --git a/src/Exception/ServerInvalidException.php b/src/Exception/ServerInvalidException.php index d8071ff..dc8b527 100644 --- a/src/Exception/ServerInvalidException.php +++ b/src/Exception/ServerInvalidException.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Exception; use RuntimeException; diff --git a/src/Exception/SocketAcceptException.php b/src/Exception/SocketAcceptException.php index 3f888a5..63604e7 100644 --- a/src/Exception/SocketAcceptException.php +++ b/src/Exception/SocketAcceptException.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Exception; use RuntimeException; diff --git a/src/Handler/ProcessStopHandler.php b/src/Handler/ProcessStopHandler.php index 66757dc..f0459da 100644 --- a/src/Handler/ProcessStopHandler.php +++ b/src/Handler/ProcessStopHandler.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Handler; use Hyperf\Process\ProcessManager; diff --git a/src/Listener/BootProcessListener.php b/src/Listener/BootProcessListener.php index cf5694d..9bfdb52 100644 --- a/src/Listener/BootProcessListener.php +++ b/src/Listener/BootProcessListener.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Listener; use Hyperf\Contract\ConfigInterface; diff --git a/src/Listener/LogAfterProcessStoppedListener.php b/src/Listener/LogAfterProcessStoppedListener.php index cf29299..c892e96 100644 --- a/src/Listener/LogAfterProcessStoppedListener.php +++ b/src/Listener/LogAfterProcessStoppedListener.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Listener; use Hyperf\Contract\StdoutLoggerInterface; diff --git a/src/Listener/LogBeforeProcessStartListener.php b/src/Listener/LogBeforeProcessStartListener.php index 67c8c18..9bf0708 100644 --- a/src/Listener/LogBeforeProcessStartListener.php +++ b/src/Listener/LogBeforeProcessStartListener.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process\Listener; use Hyperf\Contract\StdoutLoggerInterface; diff --git a/src/ProcessCollector.php b/src/ProcessCollector.php index 5440c8c..10b0d87 100644 --- a/src/ProcessCollector.php +++ b/src/ProcessCollector.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process; use Swoole\Process; diff --git a/src/ProcessManager.php b/src/ProcessManager.php index 5bb6b73..8a8681f 100644 --- a/src/ProcessManager.php +++ b/src/ProcessManager.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace Hyperf\Process; use Hyperf\Contract\ProcessInterface; diff --git a/tests/BootProcessListenerTest.php b/tests/BootProcessListenerTest.php index da9289c..ae08413 100644 --- a/tests/BootProcessListenerTest.php +++ b/tests/BootProcessListenerTest.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace HyperfTest\Process; use Hyperf\Contract\ConfigInterface; diff --git a/tests/ProcessTest.php b/tests/ProcessTest.php index 6e82697..f5f69ff 100644 --- a/tests/ProcessTest.php +++ b/tests/ProcessTest.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace HyperfTest\Process; use Hyperf\Context\ApplicationContext; @@ -17,10 +18,12 @@ use HyperfTest\Process\Stub\FooProcess; use Mockery; use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Psr\EventDispatcher\EventDispatcherInterface; use ReflectionClass; +use Swoole\Server; /** * @internal @@ -41,7 +44,7 @@ protected function tearDown(): void self::$dispatched = []; } - #[\PHPUnit\Framework\Attributes\Group('NonCoroutine')] + #[Group('NonCoroutine')] public function testEventWhenThrowExceptionInProcess() { $container = $this->getContainer(); @@ -71,7 +74,7 @@ protected function getContainer() protected function getServer() { - $server = Mockery::mock(\Swoole\Server::class); + $server = Mockery::mock(Server::class); $server->shouldReceive('addProcess')->withAnyArgs()->andReturnUsing(function ($process) { $ref = new ReflectionClass($process); $property = $ref->getProperty('callback'); diff --git a/tests/Stub/FooProcess.php b/tests/Stub/FooProcess.php index a35c8e2..4183dff 100644 --- a/tests/Stub/FooProcess.php +++ b/tests/Stub/FooProcess.php @@ -9,6 +9,7 @@ * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ + namespace HyperfTest\Process\Stub; use Hyperf\Process\AbstractProcess;