| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 |  { | 
| 28 | 28 | protected function compile(string $source, array $visitors = [], LoaderInterface $loader = null) | 
| 29 | 29 |      { | 
| 30 | -        if ($loader === null) { | |
| 30 | +        if ($loader === null){ | |
| 31 | 31 | $loader = new StringLoader(); | 
| 32 | 32 |              $loader->set('root', $source); | 
| 33 | 33 | } | 
| @@ -62,11 +62,11 @@ discard block | ||
| 62 | 62 | $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup())); | 
| 63 | 63 | $builder->getCompiler()->addRenderer(new HTMLRenderer()); | 
| 64 | 64 | |
| 65 | -        foreach ($this->getVisitors() as $visitor) { | |
| 65 | +        foreach ($this->getVisitors() as $visitor){ | |
| 66 | 66 | $builder->addVisitor($visitor); | 
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -        foreach ($visitors as $visitor) { | |
| 69 | +        foreach ($visitors as $visitor){ | |
| 70 | 70 | $builder->addVisitor($visitor); | 
| 71 | 71 | } | 
| 72 | 72 | |
| @@ -80,6 +80,6 @@ discard block | ||
| 80 | 80 | |
| 81 | 81 | protected function getFixtureLoader(): LoaderInterface | 
| 82 | 82 |      { | 
| 83 | - return new DirectoryLoader(__DIR__ . '/../fixtures'); | |
| 83 | + return new DirectoryLoader(__DIR__.'/../fixtures'); | |
| 84 | 84 | } | 
| 85 | 85 | } | 
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 | $queue = m::mock(QueueInterface::class) | 
| 25 | 25 | ); | 
| 26 | 26 | |
| 27 | -        if (!\is_array($payload)) { | |
| 27 | +        if (!\is_array($payload)){ | |
| 28 | 28 |              $this->markTestIncomplete('QueueInterface does not support non-array payloads'); | 
| 29 | 29 | return; | 
| 30 | 30 | } | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | $queue = m::mock(QueueInterface::class) | 
| 47 | 47 | ); | 
| 48 | 48 | |
| 49 | -        if (!\is_array($payload)) { | |
| 49 | +        if (!\is_array($payload)){ | |
| 50 | 50 |              $this->markTestIncomplete('QueueInterface does not support non-array payloads'); | 
| 51 | 51 | return; | 
| 52 | 52 | } | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | && $payload === ['baz' => 'baf'] | 
| 82 | 82 |                  && $options->getHeader('foo') === ['bar']); | 
| 83 | 83 | |
| 84 | -        ContainerScope::runScope($container, function() use($core) { | |
| 84 | +        ContainerScope::runScope($container, function () use($core) { | |
| 85 | 85 |              $core->callAction('foo', 'bar', [ | 
| 86 | 86 | 'id' => 'job-id', | 
| 87 | 87 | 'payload' => ['baz' => 'baf'], | 
| @@ -24,7 +24,8 @@ discard block | ||
| 24 | 24 | $queue = m::mock(QueueInterface::class) | 
| 25 | 25 | ); | 
| 26 | 26 | |
| 27 | -        if (!\is_array($payload)) { | |
| 27 | + if (!\is_array($payload)) | |
| 28 | +        { | |
| 28 | 29 |              $this->markTestIncomplete('QueueInterface does not support non-array payloads'); | 
| 29 | 30 | return; | 
| 30 | 31 | } | 
| @@ -46,7 +47,8 @@ discard block | ||
| 46 | 47 | $queue = m::mock(QueueInterface::class) | 
| 47 | 48 | ); | 
| 48 | 49 | |
| 49 | -        if (!\is_array($payload)) { | |
| 50 | + if (!\is_array($payload)) | |
| 51 | +        { | |
| 50 | 52 |              $this->markTestIncomplete('QueueInterface does not support non-array payloads'); | 
| 51 | 53 | return; | 
| 52 | 54 | } | 
| @@ -81,7 +83,8 @@ discard block | ||
| 81 | 83 | && $payload === ['baz' => 'baf'] | 
| 82 | 84 |                  && $options->getHeader('foo') === ['bar']); | 
| 83 | 85 | |
| 84 | -        ContainerScope::runScope($container, function() use($core) { | |
| 86 | + ContainerScope::runScope($container, function() use($core) | |
| 87 | +        { | |
| 85 | 88 |              $core->callAction('foo', 'bar', [ | 
| 86 | 89 | 'id' => 'job-id', | 
| 87 | 90 | 'payload' => ['baz' => 'baf'], | 
| @@ -86,7 +86,7 @@ | ||
| 86 | 86 | /** | 
| 87 | 87 | * @throws \Throwable | 
| 88 | 88 | */ | 
| 89 | - protected function getEnv(array $env, bool $overwite= true): EnvironmentInterface | |
| 89 | + protected function getEnv(array $env, bool $overwite = true): EnvironmentInterface | |
| 90 | 90 |      { | 
| 91 | 91 | $core = TestCore::create(['root' => __DIR__])->run(new Environment($env, $overwite)); | 
| 92 | 92 | |
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |      { | 
| 90 | 90 | $core = $this->getCore(); | 
| 91 | 91 | |
| 92 | -        $core->setHandler(function ($req, $resp) { | |
| 92 | +        $core->setHandler(function ($req, $resp){ | |
| 93 | 93 | echo 'hello!'; | 
| 94 | 94 | |
| 95 | 95 |              return $resp->withAddedHeader('hello', 'value'); | 
| @@ -105,7 +105,7 @@ discard block | ||
| 105 | 105 |      { | 
| 106 | 106 | $core = $this->getCore(); | 
| 107 | 107 | |
| 108 | -        $core->setHandler(function ($req, $resp) { | |
| 108 | +        $core->setHandler(function ($req, $resp){ | |
| 109 | 109 | echo 'hello!'; | 
| 110 | 110 |              $resp->getBody()->write('world '); | 
| 111 | 111 | |
| @@ -122,7 +122,7 @@ discard block | ||
| 122 | 122 |      { | 
| 123 | 123 | $core = $this->getCore(); | 
| 124 | 124 | |
| 125 | -        $core->setHandler(function () { | |
| 125 | +        $core->setHandler(function (){ | |
| 126 | 126 | ob_start(); | 
| 127 | 127 | ob_start(); | 
| 128 | 128 | echo 'hello!'; | 
| @@ -232,7 +232,7 @@ discard block | ||
| 232 | 232 | $dispatcher | 
| 233 | 233 | ->expects(self::exactly(2)) | 
| 234 | 234 |              ->method('dispatch') | 
| 235 | - ->with($this->callback(static fn(RequestReceived|RequestHandled $event): bool => true)); | |
| 235 | + ->with($this->callback(static fn(RequestReceived | RequestHandled $event): bool => true)); | |
| 236 | 236 | $this->container->bind(EventDispatcherInterface::class, $dispatcher); | 
| 237 | 237 | |
| 238 | 238 | $core = $this->getCore(); | 
| @@ -289,7 +289,7 @@ discard block | ||
| 289 | 289 | TraceKind::SERVER, | 
| 290 | 290 | ) | 
| 291 | 291 | ->willReturnCallback( | 
| 292 | -                function ($name, $callback, $attributes, $scoped, $traceKind) { | |
| 292 | +                function ($name, $callback, $attributes, $scoped, $traceKind){ | |
| 293 | 293 | self::assertSame($attributes, [ | 
| 294 | 294 | 'http.method' => 'GET', | 
| 295 | 295 | 'http.url' => 'http://example.org/path', | 
| @@ -89,7 +89,8 @@ discard block | ||
| 89 | 89 |      { | 
| 90 | 90 | $core = $this->getCore(); | 
| 91 | 91 | |
| 92 | -        $core->setHandler(function ($req, $resp) { | |
| 92 | + $core->setHandler(function ($req, $resp) | |
| 93 | +        { | |
| 93 | 94 | echo 'hello!'; | 
| 94 | 95 | |
| 95 | 96 |              return $resp->withAddedHeader('hello', 'value'); | 
| @@ -105,7 +106,8 @@ discard block | ||
| 105 | 106 |      { | 
| 106 | 107 | $core = $this->getCore(); | 
| 107 | 108 | |
| 108 | -        $core->setHandler(function ($req, $resp) { | |
| 109 | + $core->setHandler(function ($req, $resp) | |
| 110 | +        { | |
| 109 | 111 | echo 'hello!'; | 
| 110 | 112 |              $resp->getBody()->write('world '); | 
| 111 | 113 | |
| @@ -122,7 +124,8 @@ discard block | ||
| 122 | 124 |      { | 
| 123 | 125 | $core = $this->getCore(); | 
| 124 | 126 | |
| 125 | -        $core->setHandler(function () { | |
| 127 | + $core->setHandler(function () | |
| 128 | +        { | |
| 126 | 129 | ob_start(); | 
| 127 | 130 | ob_start(); | 
| 128 | 131 | echo 'hello!'; | 
| @@ -289,7 +292,8 @@ discard block | ||
| 289 | 292 | TraceKind::SERVER, | 
| 290 | 293 | ) | 
| 291 | 294 | ->willReturnCallback( | 
| 292 | -                function ($name, $callback, $attributes, $scoped, $traceKind) { | |
| 295 | + function ($name, $callback, $attributes, $scoped, $traceKind) | |
| 296 | +                { | |
| 293 | 297 | self::assertSame($attributes, [ | 
| 294 | 298 | 'http.method' => 'GET', | 
| 295 | 299 | 'http.url' => 'http://example.org/path', | 
| @@ -99,9 +99,9 @@ discard block | ||
| 99 | 99 | $rValue = 'return-value'; | 
| 100 | 100 | $stream = $this->createStream(self::DEFAULT_SEQUENCE, $rValue); | 
| 101 | 101 | |
| 102 | - $result = (string) $stream; | |
| 102 | + $result = (string)$stream; | |
| 103 | 103 | |
| 104 | - $this->assertSame(self::DEFAULT_CONTENT_RESULT . $rValue, $result); | |
| 104 | + $this->assertSame(self::DEFAULT_CONTENT_RESULT.$rValue, $result); | |
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | public function testToStringWithReturnOnly(): void | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | $rValue = 'return-value'; | 
| 110 | 110 | $stream = $this->createStream([], $rValue); | 
| 111 | 111 | |
| 112 | - $result = (string) $stream; | |
| 112 | + $result = (string)$stream; | |
| 113 | 113 | |
| 114 | 114 | $this->assertSame($rValue, $result); | 
| 115 | 115 | } | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | $stream = $this->createStream(); | 
| 120 | 120 | $stream->close(); | 
| 121 | 121 | |
| 122 | -        $this->assertSame('', (string) $stream); | |
| 122 | +        $this->assertSame('', (string)$stream); | |
| 123 | 123 | |
| 124 | 124 | $this->expectException(RuntimeException::class); | 
| 125 | 125 |          $this->expectExceptionMessage('Unable to read stream contents.'); | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | |
| 61 | 61 | public function testMiddlewareProcessingEventShouldBeDispatched(): void | 
| 62 | 62 |      { | 
| 63 | -        $middleware = new class implements MiddlewareInterface { | |
| 63 | +        $middleware = new class implements MiddlewareInterface{ | |
| 64 | 64 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface | 
| 65 | 65 |              { | 
| 66 | 66 | return (new ResponseFactory(new HttpConfig(['headers' => []])))->createResponse(200); | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |          $this->container->getBinder('http') | 
| 90 | 90 | ->bind(ServerRequestInterface::class, static fn(CurrentRequest $cr) => $cr->get()); | 
| 91 | 91 | |
| 92 | -        $middleware = new class implements MiddlewareInterface { | |
| 92 | +        $middleware = new class implements MiddlewareInterface{ | |
| 93 | 93 | public function process( | 
| 94 | 94 | ServerRequestInterface $request, | 
| 95 | 95 | RequestHandlerInterface $handler, | 
| @@ -60,7 +60,8 @@ discard block | ||
| 60 | 60 | |
| 61 | 61 | public function testMiddlewareProcessingEventShouldBeDispatched(): void | 
| 62 | 62 |      { | 
| 63 | -        $middleware = new class implements MiddlewareInterface { | |
| 63 | + $middleware = new class implements MiddlewareInterface | |
| 64 | +        { | |
| 64 | 65 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface | 
| 65 | 66 |              { | 
| 66 | 67 | return (new ResponseFactory(new HttpConfig(['headers' => []])))->createResponse(200); | 
| @@ -89,7 +90,8 @@ discard block | ||
| 89 | 90 |          $this->container->getBinder('http') | 
| 90 | 91 | ->bind(ServerRequestInterface::class, static fn(CurrentRequest $cr) => $cr->get()); | 
| 91 | 92 | |
| 92 | -        $middleware = new class implements MiddlewareInterface { | |
| 93 | + $middleware = new class implements MiddlewareInterface | |
| 94 | +        { | |
| 93 | 95 | public function process( | 
| 94 | 96 | ServerRequestInterface $request, | 
| 95 | 97 | RequestHandlerInterface $handler, | 
| @@ -107,7 +109,8 @@ discard block | ||
| 107 | 109 | |
| 108 | 110 | $this->container->runScope( | 
| 109 | 111 | new \Spiral\Core\Scope(name: 'http'), | 
| 110 | -            function (ScopeInterface $c) use ($middleware) { | |
| 112 | + function (ScopeInterface $c) use ($middleware) | |
| 113 | +            { | |
| 111 | 114 |                  $request = new ServerRequest('GET', ''); | 
| 112 | 115 | $handler = new CallableHandler(fn() => 'response', new ResponseFactory(new HttpConfig(['headers' => []]))); | 
| 113 | 116 | |
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | $target = Target::fromReflectionMethod($reflection, self::class); | 
| 48 | 48 | |
| 49 | 49 | self::assertSame($reflection, $target->getReflection()); | 
| 50 | - self::assertSame(self::class . '->' . __FUNCTION__, (string)$target); | |
| 50 | + self::assertSame(self::class.'->'.__FUNCTION__, (string)$target); | |
| 51 | 51 | self::assertNull($target->getObject()); | 
| 52 | 52 | } | 
| 53 | 53 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | $target = Target::fromReflectionMethod($reflection, $this); | 
| 59 | 59 | |
| 60 | 60 | self::assertSame($reflection, $target->getReflection()); | 
| 61 | - self::assertSame(self::class . '->' . __FUNCTION__, (string)$target); | |
| 61 | + self::assertSame(self::class.'->'.__FUNCTION__, (string)$target); | |
| 62 | 62 | self::assertNotNull($target->getObject()); | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -124,7 +124,7 @@ discard block | ||
| 124 | 124 | $reflection = $target->getReflection(); | 
| 125 | 125 | self::assertSame($hasReflection, $reflection !== null); | 
| 126 | 126 | self::assertNull($target->getObject()); | 
| 127 | -        if ($hasReflection) { | |
| 127 | +        if ($hasReflection){ | |
| 128 | 128 | self::assertInstanceOf(\ReflectionMethod::class, $reflection); | 
| 129 | 129 | self::assertSame($action, $reflection->getName()); | 
| 130 | 130 | } | 
| @@ -16,11 +16,11 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | protected function deleteDeclaration(string $class): void | 
| 18 | 18 |      { | 
| 19 | -        if (class_exists($class)) { | |
| 20 | -            try { | |
| 19 | +        if (class_exists($class)){ | |
| 20 | +            try{ | |
| 21 | 21 | $reflection = new ReflectionClass($class); | 
| 22 | 22 | $this->files()->delete($reflection->getFileName()); | 
| 23 | -            } catch (Throwable $exception) { | |
| 23 | +            }catch (Throwable $exception){ | |
| 24 | 24 | var_dump($exception->getMessage()); | 
| 25 | 25 | } | 
| 26 | 26 | } | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 |      { | 
| 47 | 47 | parent::tearDown(); | 
| 48 | 48 | |
| 49 | -        if ($this->className) { | |
| 49 | +        if ($this->className){ | |
| 50 | 50 | $this->deleteDeclaration($this->className); | 
| 51 | 51 | } | 
| 52 | 52 | } | 
| @@ -16,11 +16,15 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | protected function deleteDeclaration(string $class): void | 
| 18 | 18 |      { | 
| 19 | -        if (class_exists($class)) { | |
| 20 | -            try { | |
| 19 | + if (class_exists($class)) | |
| 20 | +        { | |
| 21 | + try | |
| 22 | +            { | |
| 21 | 23 | $reflection = new ReflectionClass($class); | 
| 22 | 24 | $this->files()->delete($reflection->getFileName()); | 
| 23 | -            } catch (Throwable $exception) { | |
| 25 | + } | |
| 26 | + catch (Throwable $exception) | |
| 27 | +            { | |
| 24 | 28 | var_dump($exception->getMessage()); | 
| 25 | 29 | } | 
| 26 | 30 | } | 
| @@ -46,7 +50,8 @@ discard block | ||
| 46 | 50 |      { | 
| 47 | 51 | parent::tearDown(); | 
| 48 | 52 | |
| 49 | -        if ($this->className) { | |
| 53 | + if ($this->className) | |
| 54 | +        { | |
| 50 | 55 | $this->deleteDeclaration($this->className); | 
| 51 | 56 | } | 
| 52 | 57 | } | 
| @@ -257,10 +257,10 @@ | ||
| 257 | 257 |      { | 
| 258 | 258 | $result = []; | 
| 259 | 259 | |
| 260 | -        foreach ($response->getHeaders() as $header) { | |
| 261 | -            foreach ($header as $headerLine) { | |
| 260 | +        foreach ($response->getHeaders() as $header){ | |
| 261 | +            foreach ($header as $headerLine){ | |
| 262 | 262 |                  $chunk = explode(';', $headerLine); | 
| 263 | -                if (mb_strpos($chunk[0], '=') === false) { | |
| 263 | +                if (mb_strpos($chunk[0], '=') === false){ | |
| 264 | 264 | continue; | 
| 265 | 265 | } | 
| 266 | 266 | |
| @@ -257,10 +257,13 @@ | ||
| 257 | 257 |      { | 
| 258 | 258 | $result = []; | 
| 259 | 259 | |
| 260 | -        foreach ($response->getHeaders() as $header) { | |
| 261 | -            foreach ($header as $headerLine) { | |
| 260 | + foreach ($response->getHeaders() as $header) | |
| 261 | +        { | |
| 262 | + foreach ($header as $headerLine) | |
| 263 | +            { | |
| 262 | 264 |                  $chunk = explode(';', $headerLine); | 
| 263 | -                if (mb_strpos($chunk[0], '=') === false) { | |
| 265 | + if (mb_strpos($chunk[0], '=') === false) | |
| 266 | +                { | |
| 264 | 267 | continue; | 
| 265 | 268 | } | 
| 266 | 269 | |