@@ -40,9 +40,9 @@ |
||
40 | 40 | public function defineDirectories(string $root): array |
41 | 41 | { |
42 | 42 | return [ |
43 | - 'app' => __DIR__ . '/fixtures', |
|
44 | - 'cache' => __DIR__ . '/cache', |
|
45 | - 'config' => __DIR__ . '/config', |
|
43 | + 'app' => __DIR__.'/fixtures', |
|
44 | + 'cache' => __DIR__.'/cache', |
|
45 | + 'config' => __DIR__.'/config', |
|
46 | 46 | ] + parent::defineDirectories($root); |
47 | 47 | } |
48 | 48 |
@@ -30,13 +30,13 @@ |
||
30 | 30 | #[TestScope("http")] |
31 | 31 | public function testCache(): void |
32 | 32 | { |
33 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
33 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
34 | 34 | |
35 | 35 | $s = $this->getStempler(); |
36 | 36 | $this->assertSame('test', $s->get('test', new ViewContext())->render([])); |
37 | - $this->assertCount(2, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
37 | + $this->assertCount(2, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
38 | 38 | |
39 | 39 | $s->reset('test', new ViewContext()); |
40 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/../cache/', '*.php')); |
|
40 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/../cache/', '*.php')); |
|
41 | 41 | } |
42 | 42 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function testNoScope(): void |
36 | 36 | { |
37 | 37 | $c = new Container(); |
38 | - $c->runScope(new Scope(), function () { |
|
38 | + $c->runScope(new Scope(), function (){ |
|
39 | 39 | $logger = $this->getLogger(); |
40 | 40 | $this->assertInstanceOf(NullLogger::class, $this->getLogger()); |
41 | 41 | $this->assertSame($logger, $this->getLogger()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $c->bind(LogsInterface::class, $mock); |
53 | 53 | |
54 | - $c->runScope(new Scope(), function () { |
|
54 | + $c->runScope(new Scope(), function (){ |
|
55 | 55 | $logger = $this->getLogger(); |
56 | 56 | $this->assertInstanceOf(\Spiral\Logger\NullLogger::class, $this->getLogger()); |
57 | 57 | $this->assertSame($logger, $this->getLogger()); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->container->bind( |
74 | 74 | ConfiguratorInterface::class, |
75 | 75 | new ConfigManager( |
76 | - new class() implements LoaderInterface { |
|
76 | + new class() implements LoaderInterface{ |
|
77 | 77 | public function has(string $section): bool |
78 | 78 | { |
79 | 79 | return false; |
@@ -35,7 +35,8 @@ discard block |
||
35 | 35 | public function testNoScope(): void |
36 | 36 | { |
37 | 37 | $c = new Container(); |
38 | - $c->runScope(new Scope(), function () { |
|
38 | + $c->runScope(new Scope(), function () |
|
39 | + { |
|
39 | 40 | $logger = $this->getLogger(); |
40 | 41 | $this->assertInstanceOf(NullLogger::class, $this->getLogger()); |
41 | 42 | $this->assertSame($logger, $this->getLogger()); |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | |
52 | 53 | $c->bind(LogsInterface::class, $mock); |
53 | 54 | |
54 | - $c->runScope(new Scope(), function () { |
|
55 | + $c->runScope(new Scope(), function () |
|
56 | + { |
|
55 | 57 | $logger = $this->getLogger(); |
56 | 58 | $this->assertInstanceOf(\Spiral\Logger\NullLogger::class, $this->getLogger()); |
57 | 59 | $this->assertSame($logger, $this->getLogger()); |
@@ -73,7 +75,8 @@ discard block |
||
73 | 75 | $this->container->bind( |
74 | 76 | ConfiguratorInterface::class, |
75 | 77 | new ConfigManager( |
76 | - new class() implements LoaderInterface { |
|
78 | + new class() implements LoaderInterface |
|
79 | + { |
|
77 | 80 | public function has(string $section): bool |
78 | 81 | { |
79 | 82 | return false; |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | { |
53 | 53 | $s = $this->getStempler(); |
54 | 54 | |
55 | - try { |
|
55 | + try{ |
|
56 | 56 | $s->get('echo', new ViewContext())->render(); |
57 | 57 | $this->fail('Exception expected'); |
58 | - } catch (RenderException $e) { |
|
58 | + }catch (RenderException $e){ |
|
59 | 59 | $t = $e->getUserTrace()[0]; |
60 | 60 | |
61 | 61 | $this->assertSame(2, $t['line']); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | { |
68 | 68 | $s = $this->getStempler(); |
69 | 69 | |
70 | - try { |
|
70 | + try{ |
|
71 | 71 | $s->get('other:echo-in', new ViewContext())->render(); |
72 | 72 | $this->fail('Exception expected'); |
73 | - } catch (RenderException $e) { |
|
73 | + }catch (RenderException $e){ |
|
74 | 74 | $t = $e->getUserTrace(); |
75 | 75 | $this->assertCount(2, $t); |
76 | 76 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | { |
87 | 87 | $twig = $this->getStempler(); |
88 | 88 | |
89 | - try { |
|
89 | + try{ |
|
90 | 90 | $twig->get('other:bad', new ViewContext()); |
91 | - } catch (CompileException $e) { |
|
91 | + }catch (CompileException $e){ |
|
92 | 92 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
93 | 93 | } |
94 | 94 | } |
@@ -52,10 +52,13 @@ discard block |
||
52 | 52 | { |
53 | 53 | $s = $this->getStempler(); |
54 | 54 | |
55 | - try { |
|
55 | + try |
|
56 | + { |
|
56 | 57 | $s->get('echo', new ViewContext())->render(); |
57 | 58 | $this->fail('Exception expected'); |
58 | - } catch (RenderException $e) { |
|
59 | + } |
|
60 | + catch (RenderException $e) |
|
61 | + { |
|
59 | 62 | $t = $e->getUserTrace()[0]; |
60 | 63 | |
61 | 64 | $this->assertSame(2, $t['line']); |
@@ -67,10 +70,13 @@ discard block |
||
67 | 70 | { |
68 | 71 | $s = $this->getStempler(); |
69 | 72 | |
70 | - try { |
|
73 | + try |
|
74 | + { |
|
71 | 75 | $s->get('other:echo-in', new ViewContext())->render(); |
72 | 76 | $this->fail('Exception expected'); |
73 | - } catch (RenderException $e) { |
|
77 | + } |
|
78 | + catch (RenderException $e) |
|
79 | + { |
|
74 | 80 | $t = $e->getUserTrace(); |
75 | 81 | $this->assertCount(2, $t); |
76 | 82 | |
@@ -86,9 +92,12 @@ discard block |
||
86 | 92 | { |
87 | 93 | $twig = $this->getStempler(); |
88 | 94 | |
89 | - try { |
|
95 | + try |
|
96 | + { |
|
90 | 97 | $twig->get('other:bad', new ViewContext()); |
91 | - } catch (CompileException $e) { |
|
98 | + } |
|
99 | + catch (CompileException $e) |
|
100 | + { |
|
92 | 101 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
93 | 102 | } |
94 | 103 | } |
@@ -22,8 +22,8 @@ |
||
22 | 22 | public function setTags(array $tags): void |
23 | 23 | { |
24 | 24 | $setTags = []; |
25 | - foreach ($tags as $key => $value) { |
|
26 | - if (!\is_string($value)) { |
|
25 | + foreach ($tags as $key => $value){ |
|
26 | + if (!\is_string($value)){ |
|
27 | 27 | throw new StateException(\sprintf( |
28 | 28 | 'Invalid tag value, string expected got %s', |
29 | 29 | \get_debug_type($value) |
@@ -22,8 +22,10 @@ |
||
22 | 22 | public function setTags(array $tags): void |
23 | 23 | { |
24 | 24 | $setTags = []; |
25 | - foreach ($tags as $key => $value) { |
|
26 | - if (!\is_string($value)) { |
|
25 | + foreach ($tags as $key => $value) |
|
26 | + { |
|
27 | + if (!\is_string($value)) |
|
28 | + { |
|
27 | 29 | throw new StateException(\sprintf( |
28 | 30 | 'Invalid tag value, string expected got %s', |
29 | 31 | \get_debug_type($value) |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function addListener(callable $listener): self |
16 | 16 | { |
17 | - if (!\in_array($listener, $this->listeners, true)) { |
|
17 | + if (!\in_array($listener, $this->listeners, true)){ |
|
18 | 18 | $this->listeners[] = $listener; |
19 | 19 | } |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function removeListener(callable $listener): void |
25 | 25 | { |
26 | 26 | $key = \array_search($listener, $this->listeners, true); |
27 | - if ($key !== false) { |
|
27 | + if ($key !== false){ |
|
28 | 28 | unset($this->listeners[$key]); |
29 | 29 | } |
30 | 30 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | public function addListener(callable $listener): self |
16 | 16 | { |
17 | - if (!\in_array($listener, $this->listeners, true)) { |
|
17 | + if (!\in_array($listener, $this->listeners, true)) |
|
18 | + { |
|
18 | 19 | $this->listeners[] = $listener; |
19 | 20 | } |
20 | 21 | |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | public function removeListener(callable $listener): void |
25 | 26 | { |
26 | 27 | $key = \array_search($listener, $this->listeners, true); |
27 | - if ($key !== false) { |
|
28 | + if ($key !== false) |
|
29 | + { |
|
28 | 30 | unset($this->listeners[$key]); |
29 | 31 | } |
30 | 32 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | // Automatically prepend HTTP verb to all action names. |
28 | 28 | public const RESTFUL = 1; |
29 | 29 | |
30 | - private HandlerInterface|CoreInterface|null $pipeline = null; |
|
30 | + private HandlerInterface | CoreInterface | null $pipeline = null; |
|
31 | 31 | private ?CoreHandler $handler = null; |
32 | 32 | private bool $verbActions; |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private array $constrains, |
37 | 37 | int $options = 0, |
38 | 38 | private string $defaultAction = 'index' |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | $this->verbActions = ($options & self::RESTFUL) === self::RESTFUL; |
41 | 41 | } |
42 | 42 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @mutation-free |
55 | 55 | * @deprecated Use {@see withHandler()} instead. |
56 | 56 | */ |
57 | - public function withCore(HandlerInterface|CoreInterface $core): TargetInterface |
|
57 | + public function withCore(HandlerInterface | CoreInterface $core): TargetInterface |
|
58 | 58 | { |
59 | 59 | $target = clone $this; |
60 | 60 | $target->pipeline = $core; |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | |
87 | 87 | protected function coreHandler(ContainerInterface $container): CoreHandler |
88 | 88 | { |
89 | - if ($this->handler !== null) { |
|
89 | + if ($this->handler !== null){ |
|
90 | 90 | return $this->handler; |
91 | 91 | } |
92 | 92 | |
93 | 93 | $scope = Proxy::create(new \ReflectionClass(ScopeInterface::class), null, new \Spiral\Core\Attribute\Proxy()); |
94 | 94 | |
95 | - try { |
|
95 | + try{ |
|
96 | 96 | // construct on demand |
97 | 97 | $this->handler = new CoreHandler( |
98 | 98 | match (false) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ); |
107 | 107 | |
108 | 108 | return $this->handler; |
109 | - } catch (ContainerExceptionInterface $e) { |
|
109 | + }catch (ContainerExceptionInterface $e){ |
|
110 | 110 | throw new TargetException($e->getMessage(), $e->getCode(), $e); |
111 | 111 | } |
112 | 112 | } |
@@ -86,13 +86,15 @@ discard block |
||
86 | 86 | |
87 | 87 | protected function coreHandler(ContainerInterface $container): CoreHandler |
88 | 88 | { |
89 | - if ($this->handler !== null) { |
|
89 | + if ($this->handler !== null) |
|
90 | + { |
|
90 | 91 | return $this->handler; |
91 | 92 | } |
92 | 93 | |
93 | 94 | $scope = Proxy::create(new \ReflectionClass(ScopeInterface::class), null, new \Spiral\Core\Attribute\Proxy()); |
94 | 95 | |
95 | - try { |
|
96 | + try |
|
97 | + { |
|
96 | 98 | // construct on demand |
97 | 99 | $this->handler = new CoreHandler( |
98 | 100 | match (false) { |
@@ -106,7 +108,9 @@ discard block |
||
106 | 108 | ); |
107 | 109 | |
108 | 110 | return $this->handler; |
109 | - } catch (ContainerExceptionInterface $e) { |
|
111 | + } |
|
112 | + catch (ContainerExceptionInterface $e) |
|
113 | + { |
|
110 | 114 | throw new TargetException($e->getMessage(), $e->getCode(), $e); |
111 | 115 | } |
112 | 116 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | public function __construct( |
18 | 18 | #[Proxy] private ScopeInterface $scope, |
19 | - ) {} |
|
19 | + ){} |
|
20 | 20 | |
21 | 21 | public function process( |
22 | 22 | ServerRequestInterface $request, |
@@ -16,7 +16,8 @@ |
||
16 | 16 | { |
17 | 17 | public function __construct( |
18 | 18 | #[Proxy] private ScopeInterface $scope, |
19 | - ) {} |
|
19 | + ) { |
|
20 | +} |
|
20 | 21 | |
21 | 22 | public function process( |
22 | 23 | ServerRequestInterface $request, |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | namespace Spiral\Framework; |
6 | 6 | |
7 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
7 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
8 | 8 | |
9 | -if (!\enum_exists(Spiral::class)) { |
|
9 | +if (!\enum_exists(Spiral::class)){ |
|
10 | 10 | enum Spiral: string { |
11 | 11 | case HttpRequest = 'http-request'; |
12 | 12 | } |
@@ -6,7 +6,8 @@ |
||
6 | 6 | |
7 | 7 | require_once __DIR__ . '/../vendor/autoload.php'; |
8 | 8 | |
9 | -if (!\enum_exists(Spiral::class)) { |
|
9 | +if (!\enum_exists(Spiral::class)) |
|
10 | +{ |
|
10 | 11 | enum Spiral: string { |
11 | 12 | case HttpRequest = 'http-request'; |
12 | 13 | } |