@@ -21,7 +21,7 @@ |
||
21 | 21 | ?string $clientFilename = null, |
22 | 22 | ?string $clientMediaType = null |
23 | 23 | ): UploadedFileInterface { |
24 | - if ($size === null) { |
|
24 | + if ($size === null){ |
|
25 | 25 | $size = $stream->getSize(); |
26 | 26 | } |
27 | 27 |
@@ -21,7 +21,8 @@ |
||
21 | 21 | ?string $clientFilename = null, |
22 | 22 | ?string $clientMediaType = null |
23 | 23 | ): UploadedFileInterface { |
24 | - if ($size === null) { |
|
24 | + if ($size === null) |
|
25 | + { |
|
25 | 26 | $size = $stream->getSize(); |
26 | 27 | } |
27 | 28 |
@@ -18,21 +18,21 @@ discard block |
||
18 | 18 | */ |
19 | 19 | abstract public function bucket(?string $name = null): BucketInterface; |
20 | 20 | |
21 | - public function getContents(string|\Stringable $id): string |
|
21 | + public function getContents(string | \Stringable $id): string |
|
22 | 22 | { |
23 | 23 | [$name, $pathname] = $this->parseUri($id); |
24 | 24 | |
25 | 25 | return $this->bucket($name)->getContents($pathname); |
26 | 26 | } |
27 | 27 | |
28 | - public function getStream(string|\Stringable $id) |
|
28 | + public function getStream(string | \Stringable $id) |
|
29 | 29 | { |
30 | 30 | [$name, $pathname] = $this->parseUri($id); |
31 | 31 | |
32 | 32 | return $this->bucket($name)->getStream($pathname); |
33 | 33 | } |
34 | 34 | |
35 | - public function exists(string|\Stringable $id): bool |
|
35 | + public function exists(string | \Stringable $id): bool |
|
36 | 36 | { |
37 | 37 | [$name, $pathname] = $this->parseUri($id); |
38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * @return int<0, max> |
44 | 44 | */ |
45 | - public function getLastModified(string|\Stringable $id): int |
|
45 | + public function getLastModified(string | \Stringable $id): int |
|
46 | 46 | { |
47 | 47 | [$name, $pathname] = $this->parseUri($id); |
48 | 48 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return int<0, max> |
54 | 54 | */ |
55 | - public function getSize(string|\Stringable $id): int |
|
55 | + public function getSize(string | \Stringable $id): int |
|
56 | 56 | { |
57 | 57 | [$name, $pathname] = $this->parseUri($id); |
58 | 58 | |
59 | 59 | return $this->bucket($name)->getSize($pathname); |
60 | 60 | } |
61 | 61 | |
62 | - public function getMimeType(string|\Stringable $id): string |
|
62 | + public function getMimeType(string | \Stringable $id): string |
|
63 | 63 | { |
64 | 64 | [$name, $pathname] = $this->parseUri($id); |
65 | 65 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return Visibility::VISIBILITY_* |
71 | 71 | */ |
72 | 72 | #[ExpectedValues(valuesFromClass: Visibility::class)] |
73 | - public function getVisibility(string|\Stringable $id): string |
|
73 | + public function getVisibility(string | \Stringable $id): string |
|
74 | 74 | { |
75 | 75 | [$name, $pathname] = $this->parseUri($id); |
76 | 76 | |
@@ -80,5 +80,5 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * {@see Storage::parseUri()} |
82 | 82 | */ |
83 | - abstract protected function parseUri(string|\Stringable $uri, bool $withScheme = true): array; |
|
83 | + abstract protected function parseUri(string | \Stringable $uri, bool $withScheme = true): array; |
|
84 | 84 | } |
@@ -22,8 +22,8 @@ |
||
22 | 22 | |
23 | 23 | private FooEvent $ev; |
24 | 24 | private AutowireListenerFactory $factory; |
25 | - private ContainerInterface|MockInterface $container; |
|
26 | - private ClassAndMethodAttribute|MockInterface $listener; |
|
25 | + private ContainerInterface | MockInterface $container; |
|
26 | + private ClassAndMethodAttribute | MockInterface $listener; |
|
27 | 27 | |
28 | 28 | protected function setUp(): void |
29 | 29 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
49 | 49 | |
50 | - $d = new class() implements DispatcherInterface { |
|
50 | + $d = new class() implements DispatcherInterface{ |
|
51 | 51 | public static function canServe(EnvironmentInterface $env): bool |
52 | 52 | { |
53 | 53 | return true; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
69 | 69 | |
70 | - $d = new class() implements DispatcherInterface { |
|
70 | + $d = new class() implements DispatcherInterface{ |
|
71 | 71 | public function canServe(): bool |
72 | 72 | { |
73 | 73 | return true; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
92 | 92 | |
93 | - $d = new class() implements DispatcherInterface { |
|
93 | + $d = new class() implements DispatcherInterface{ |
|
94 | 94 | public static function canServe(EnvironmentInterface $env): bool |
95 | 95 | { |
96 | 96 | return true; |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | $core->getContainer()->bind('bcd', 'foo'); |
133 | 133 | }); |
134 | 134 | |
135 | - $kernel->booted( static function (TestCore $core): void { |
|
135 | + $kernel->booted(static function (TestCore $core): void { |
|
136 | 136 | $core->getContainer()->bind('cde', 'foo'); |
137 | 137 | }); |
138 | 138 | |
139 | - $kernel->booted( static function (TestCore $core): void { |
|
139 | + $kernel->booted(static function (TestCore $core): void { |
|
140 | 140 | $core->getContainer()->bind('def', 'foo'); |
141 | 141 | }); |
142 | 142 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | public function testEventsShouldBeDispatched(): void |
161 | 161 | { |
162 | - $testDispatcher = new class implements DispatcherInterface { |
|
162 | + $testDispatcher = new class implements DispatcherInterface{ |
|
163 | 163 | public static function canServe(EnvironmentInterface $env): bool |
164 | 164 | { |
165 | 165 | return true; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | }; |
172 | 172 | |
173 | 173 | $container = new Container(); |
174 | - $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container) |
|
174 | + $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container) |
|
175 | 175 | ->addDispatcher($testDispatcher); |
176 | 176 | |
177 | 177 | $dispatcher = $this->createMock(EventDispatcherInterface::class); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function testDispatcherNotFoundEventShouldBeDispatched(): void |
193 | 193 | { |
194 | 194 | $container = new Container(); |
195 | - $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container); |
|
195 | + $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container); |
|
196 | 196 | |
197 | 197 | $dispatcher = $this->createMock(EventDispatcherInterface::class); |
198 | 198 | $dispatcher |
@@ -47,7 +47,8 @@ discard block |
||
47 | 47 | { |
48 | 48 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
49 | 49 | |
50 | - $d = new class() implements DispatcherInterface { |
|
50 | + $d = new class() implements DispatcherInterface |
|
51 | + { |
|
51 | 52 | public static function canServe(EnvironmentInterface $env): bool |
52 | 53 | { |
53 | 54 | return true; |
@@ -67,7 +68,8 @@ discard block |
||
67 | 68 | { |
68 | 69 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
69 | 70 | |
70 | - $d = new class() implements DispatcherInterface { |
|
71 | + $d = new class() implements DispatcherInterface |
|
72 | + { |
|
71 | 73 | public function canServe(): bool |
72 | 74 | { |
73 | 75 | return true; |
@@ -90,7 +92,8 @@ discard block |
||
90 | 92 | { |
91 | 93 | $kernel = TestCore::create(['root' => __DIR__])->run(); |
92 | 94 | |
93 | - $d = new class() implements DispatcherInterface { |
|
95 | + $d = new class() implements DispatcherInterface |
|
96 | + { |
|
94 | 97 | public static function canServe(EnvironmentInterface $env): bool |
95 | 98 | { |
96 | 99 | return true; |
@@ -159,7 +162,8 @@ discard block |
||
159 | 162 | |
160 | 163 | public function testEventsShouldBeDispatched(): void |
161 | 164 | { |
162 | - $testDispatcher = new class implements DispatcherInterface { |
|
165 | + $testDispatcher = new class implements DispatcherInterface |
|
166 | + { |
|
163 | 167 | public static function canServe(EnvironmentInterface $env): bool |
164 | 168 | { |
165 | 169 | return true; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function testInjection(): void |
50 | 50 | { |
51 | - $factory = new class () implements LogsInterface { |
|
51 | + $factory = new class () implements LogsInterface{ |
|
52 | 52 | public function getLogger(string $channel): LoggerInterface |
53 | 53 | { |
54 | 54 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function testInjectionNullableChannel(): void |
67 | 67 | { |
68 | - $factory = new class () implements LogsInterface { |
|
68 | + $factory = new class () implements LogsInterface{ |
|
69 | 69 | public function getLogger(?string $channel): LoggerInterface |
70 | 70 | { |
71 | 71 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function testInjectionWithAttribute(): void |
84 | 84 | { |
85 | - $factory = new class () implements LogsInterface { |
|
85 | + $factory = new class () implements LogsInterface{ |
|
86 | 86 | public function getLogger(?string $channel): LoggerInterface |
87 | 87 | { |
88 | 88 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -48,7 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | public function testInjection(): void |
50 | 50 | { |
51 | - $factory = new class () implements LogsInterface { |
|
51 | + $factory = new class () implements LogsInterface |
|
52 | + { |
|
52 | 53 | public function getLogger(string $channel): LoggerInterface |
53 | 54 | { |
54 | 55 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -65,7 +66,8 @@ discard block |
||
65 | 66 | |
66 | 67 | public function testInjectionNullableChannel(): void |
67 | 68 | { |
68 | - $factory = new class () implements LogsInterface { |
|
69 | + $factory = new class () implements LogsInterface |
|
70 | + { |
|
69 | 71 | public function getLogger(?string $channel): LoggerInterface |
70 | 72 | { |
71 | 73 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -82,7 +84,8 @@ discard block |
||
82 | 84 | |
83 | 85 | public function testInjectionWithAttribute(): void |
84 | 86 | { |
85 | - $factory = new class () implements LogsInterface { |
|
87 | + $factory = new class () implements LogsInterface |
|
88 | + { |
|
86 | 89 | public function getLogger(?string $channel): LoggerInterface |
87 | 90 | { |
88 | 91 | $mock = \Mockery::mock(LoggerInterface::class); |
@@ -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 | } |
@@ -49,7 +50,8 @@ discard block |
||
49 | 50 | $queue = m::mock(QueueInterface::class) |
50 | 51 | ); |
51 | 52 | |
52 | - if (!\is_array($payload)) { |
|
53 | + if (!\is_array($payload)) |
|
54 | + { |
|
53 | 55 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
54 | 56 | return; |
55 | 57 | } |
@@ -24,13 +24,13 @@ 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 | } |
31 | 31 | |
32 | 32 | $queue->shouldReceive('push')->once() |
33 | - ->withArgs(fn(string $name, mixed $p = [], ?OptionsInterface $options = null): bool => $name === 'foo' |
|
33 | + ->withArgs(fn(string $name, mixed $p = [], ?OptionsInterface $options = null) : bool => $name === 'foo' |
|
34 | 34 | && $payload === $p |
35 | 35 | && $options instanceof Options, |
36 | 36 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $queue = m::mock(QueueInterface::class) |
50 | 50 | ); |
51 | 51 | |
52 | - if (!\is_array($payload)) { |
|
52 | + if (!\is_array($payload)){ |
|
53 | 53 | $this->markTestIncomplete('QueueInterface does not support non-array payloads'); |
54 | 54 | return; |
55 | 55 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $tracer->shouldReceive('trace')->once()->andReturnUsing(fn($name, $callback) => $callback()); |
81 | 81 | |
82 | 82 | $queue->shouldReceive('push')->once() |
83 | - ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' |
|
83 | + ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null) : bool => $name === 'foo' |
|
84 | 84 | && $payload === ['baz' => 'baf'] |
85 | 85 | && $options->getHeader('foo') === ['bar']); |
86 | 86 | |
87 | - ContainerScope::runScope($container, function() use($core): void { |
|
87 | + ContainerScope::runScope($container, function () use($core): void { |
|
88 | 88 | $core->callAction('foo', 'bar', [ |
89 | 89 | 'id' => 'job-id', |
90 | 90 | 'payload' => ['baz' => 'baf'], |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $tracer->shouldNotReceive('getContext'); |
104 | 104 | |
105 | 105 | $queue->shouldReceive('push')->once() |
106 | - ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null): bool => $name === 'foo' |
|
106 | + ->withArgs(fn(string $name, array $payload = [], ?OptionsInterface $options = null) : bool => $name === 'foo' |
|
107 | 107 | && $payload === ['baz' => 'baf'] |
108 | 108 | && $options !== null); |
109 | 109 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | protected Finder $finder, |
27 | 27 | protected readonly bool $debug = false, |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function availableReflections(): \Generator |
39 | 39 | { |
40 | - foreach ($this->finder->getIterator() as $file) { |
|
40 | + foreach ($this->finder->getIterator() as $file){ |
|
41 | 41 | $reflection = new ReflectionFile((string)$file); |
42 | 42 | |
43 | - if ($reflection->hasIncludes()) { |
|
43 | + if ($reflection->hasIncludes()){ |
|
44 | 44 | // We are not analyzing files which has includes, it's not safe to require such reflections |
45 | - if ($this->debug) { |
|
45 | + if ($this->debug){ |
|
46 | 46 | $this->getLogger()->warning( |
47 | - \sprintf('File `%s` has includes and excluded from analysis', (string) $file), |
|
47 | + \sprintf('File `%s` has includes and excluded from analysis', (string)$file), |
|
48 | 48 | ['file' => $file] |
49 | 49 | ); |
50 | 50 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | protected function classReflection(string $class): \ReflectionClass |
70 | 70 | { |
71 | 71 | $loader = static function ($class): void { |
72 | - if ($class === LocatorException::class) { |
|
72 | + if ($class === LocatorException::class){ |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | //To suspend class dependency exception |
80 | 80 | \spl_autoload_register($loader); |
81 | 81 | |
82 | - try { |
|
82 | + try{ |
|
83 | 83 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, |
84 | 84 | //we are going to handle such exception and convert it soft exception |
85 | 85 | return new \ReflectionClass($class); |
86 | - } catch (\Throwable $e) { |
|
87 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
86 | + }catch (\Throwable $e){ |
|
87 | + if ($e instanceof LocatorException && $e->getPrevious() != null){ |
|
88 | 88 | $e = $e->getPrevious(); |
89 | 89 | } |
90 | 90 | |
91 | - if ($this->debug) { |
|
91 | + if ($this->debug){ |
|
92 | 92 | $this->getLogger()->error( |
93 | 93 | \sprintf('%s: %s in %s:%s', $class, $e->getMessage(), $e->getFile(), $e->getLine()), |
94 | 94 | ['error' => $e] |
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | - throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); |
|
99 | - } finally { |
|
98 | + throw new LocatorException($e->getMessage(), (int)$e->getCode(), $e); |
|
99 | + }finally{ |
|
100 | 100 | \spl_autoload_unregister($loader); |
101 | 101 | } |
102 | 102 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | protected function enumReflection(string $enum): \ReflectionEnum |
113 | 113 | { |
114 | 114 | $loader = static function (string $enum): void { |
115 | - if ($enum === LocatorException::class) { |
|
115 | + if ($enum === LocatorException::class){ |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
@@ -122,24 +122,24 @@ discard block |
||
122 | 122 | //To suspend class dependency exception |
123 | 123 | \spl_autoload_register($loader); |
124 | 124 | |
125 | - try { |
|
125 | + try{ |
|
126 | 126 | //In some enum reflection can thrown an exception if enum invalid or can not be loaded, |
127 | 127 | //we are going to handle such exception and convert it soft exception |
128 | 128 | return new \ReflectionEnum($enum); |
129 | - } catch (\Throwable $e) { |
|
130 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
129 | + }catch (\Throwable $e){ |
|
130 | + if ($e instanceof LocatorException && $e->getPrevious() != null){ |
|
131 | 131 | $e = $e->getPrevious(); |
132 | 132 | } |
133 | 133 | |
134 | - if ($this->debug) { |
|
134 | + if ($this->debug){ |
|
135 | 135 | $this->getLogger()->error( |
136 | 136 | \sprintf('%s: %s in %s:%s', $enum, $e->getMessage(), $e->getFile(), $e->getLine()), |
137 | 137 | ['error' => $e] |
138 | 138 | ); |
139 | 139 | } |
140 | 140 | |
141 | - throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); |
|
142 | - } finally { |
|
141 | + throw new LocatorException($e->getMessage(), (int)$e->getCode(), $e); |
|
142 | + }finally{ |
|
143 | 143 | \spl_autoload_unregister($loader); |
144 | 144 | } |
145 | 145 | } |
@@ -37,12 +37,15 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function availableReflections(): \Generator |
39 | 39 | { |
40 | - foreach ($this->finder->getIterator() as $file) { |
|
40 | + foreach ($this->finder->getIterator() as $file) |
|
41 | + { |
|
41 | 42 | $reflection = new ReflectionFile((string)$file); |
42 | 43 | |
43 | - if ($reflection->hasIncludes()) { |
|
44 | + if ($reflection->hasIncludes()) |
|
45 | + { |
|
44 | 46 | // We are not analyzing files which has includes, it's not safe to require such reflections |
45 | - if ($this->debug) { |
|
47 | + if ($this->debug) |
|
48 | + { |
|
46 | 49 | $this->getLogger()->warning( |
47 | 50 | \sprintf('File `%s` has includes and excluded from analysis', (string) $file), |
48 | 51 | ['file' => $file] |
@@ -69,7 +72,8 @@ discard block |
||
69 | 72 | protected function classReflection(string $class): \ReflectionClass |
70 | 73 | { |
71 | 74 | $loader = static function ($class): void { |
72 | - if ($class === LocatorException::class) { |
|
75 | + if ($class === LocatorException::class) |
|
76 | + { |
|
73 | 77 | return; |
74 | 78 | } |
75 | 79 | |
@@ -79,16 +83,21 @@ discard block |
||
79 | 83 | //To suspend class dependency exception |
80 | 84 | \spl_autoload_register($loader); |
81 | 85 | |
82 | - try { |
|
86 | + try |
|
87 | + { |
|
83 | 88 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, |
84 | 89 | //we are going to handle such exception and convert it soft exception |
85 | 90 | return new \ReflectionClass($class); |
86 | - } catch (\Throwable $e) { |
|
87 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
91 | + } |
|
92 | + catch (\Throwable $e) |
|
93 | + { |
|
94 | + if ($e instanceof LocatorException && $e->getPrevious() != null) |
|
95 | + { |
|
88 | 96 | $e = $e->getPrevious(); |
89 | 97 | } |
90 | 98 | |
91 | - if ($this->debug) { |
|
99 | + if ($this->debug) |
|
100 | + { |
|
92 | 101 | $this->getLogger()->error( |
93 | 102 | \sprintf('%s: %s in %s:%s', $class, $e->getMessage(), $e->getFile(), $e->getLine()), |
94 | 103 | ['error' => $e] |
@@ -96,7 +105,9 @@ discard block |
||
96 | 105 | } |
97 | 106 | |
98 | 107 | throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); |
99 | - } finally { |
|
108 | + } |
|
109 | + finally |
|
110 | + { |
|
100 | 111 | \spl_autoload_unregister($loader); |
101 | 112 | } |
102 | 113 | } |
@@ -112,7 +123,8 @@ discard block |
||
112 | 123 | protected function enumReflection(string $enum): \ReflectionEnum |
113 | 124 | { |
114 | 125 | $loader = static function (string $enum): void { |
115 | - if ($enum === LocatorException::class) { |
|
126 | + if ($enum === LocatorException::class) |
|
127 | + { |
|
116 | 128 | return; |
117 | 129 | } |
118 | 130 | |
@@ -122,16 +134,21 @@ discard block |
||
122 | 134 | //To suspend class dependency exception |
123 | 135 | \spl_autoload_register($loader); |
124 | 136 | |
125 | - try { |
|
137 | + try |
|
138 | + { |
|
126 | 139 | //In some enum reflection can thrown an exception if enum invalid or can not be loaded, |
127 | 140 | //we are going to handle such exception and convert it soft exception |
128 | 141 | return new \ReflectionEnum($enum); |
129 | - } catch (\Throwable $e) { |
|
130 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
142 | + } |
|
143 | + catch (\Throwable $e) |
|
144 | + { |
|
145 | + if ($e instanceof LocatorException && $e->getPrevious() != null) |
|
146 | + { |
|
131 | 147 | $e = $e->getPrevious(); |
132 | 148 | } |
133 | 149 | |
134 | - if ($this->debug) { |
|
150 | + if ($this->debug) |
|
151 | + { |
|
135 | 152 | $this->getLogger()->error( |
136 | 153 | \sprintf('%s: %s in %s:%s', $enum, $e->getMessage(), $e->getFile(), $e->getLine()), |
137 | 154 | ['error' => $e] |
@@ -139,7 +156,9 @@ discard block |
||
139 | 156 | } |
140 | 157 | |
141 | 158 | throw new LocatorException($e->getMessage(), (int) $e->getCode(), $e); |
142 | - } finally { |
|
159 | + } |
|
160 | + finally |
|
161 | + { |
|
143 | 162 | \spl_autoload_unregister($loader); |
144 | 163 | } |
145 | 164 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | { |
22 | 22 | $root = self::makeContainer(); |
23 | 23 | |
24 | - $obj = $root->runScoped(static function (Container $c1) { |
|
25 | - $obj = $c1->runScoped(static function (Container $c2) { |
|
24 | + $obj = $root->runScoped(static function (Container $c1){ |
|
25 | + $obj = $c1->runScoped(static function (Container $c2){ |
|
26 | 26 | $obj = $c2->get(AttrScopeFooFinalize::class); |
27 | 27 | |
28 | 28 | self::assertFalse($obj->finalized); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | self::expectException(FinalizersException::class); |
125 | 125 | self::expectExceptionMessage('An exception has been thrown during finalization of the scope `foo`'); |
126 | 126 | |
127 | - try { |
|
127 | + try{ |
|
128 | 128 | $root->runScoped(static function (Container $c1): void { |
129 | 129 | $obj = $c1->get(AttrScopeFooFinalize::class); |
130 | 130 | $obj->throwException = true; |
131 | 131 | }, name: 'foo'); |
132 | - } catch (FinalizersException $e) { |
|
132 | + }catch (FinalizersException $e){ |
|
133 | 133 | self::assertSame('foo', $e->getScope()); |
134 | 134 | self::assertCount(1, $e->getExceptions()); |
135 | 135 | // Contains the message from the inner exception. |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | self::expectException(FinalizersException::class); |
154 | 154 | self::expectExceptionMessage('3 exceptions have been thrown during finalization of the scope `foo`'); |
155 | 155 | |
156 | - try { |
|
156 | + try{ |
|
157 | 157 | $root->runScoped(static function (Container $c1): void { |
158 | 158 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
159 | 159 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
160 | 160 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
161 | 161 | }, name: 'foo'); |
162 | - } catch (FinalizersException $e) { |
|
162 | + }catch (FinalizersException $e){ |
|
163 | 163 | self::assertSame('foo', $e->getScope()); |
164 | 164 | self::assertCount(3, $e->getExceptions()); |
165 | 165 | // Contains the message from the inner exception. |
@@ -21,8 +21,10 @@ discard block |
||
21 | 21 | { |
22 | 22 | $root = self::makeContainer(); |
23 | 23 | |
24 | - $obj = $root->runScoped(static function (Container $c1) { |
|
25 | - $obj = $c1->runScoped(static function (Container $c2) { |
|
24 | + $obj = $root->runScoped(static function (Container $c1) |
|
25 | + { |
|
26 | + $obj = $c1->runScoped(static function (Container $c2) |
|
27 | + { |
|
26 | 28 | $obj = $c2->get(AttrScopeFooFinalize::class); |
27 | 29 | |
28 | 30 | self::assertFalse($obj->finalized); |
@@ -46,8 +48,10 @@ discard block |
||
46 | 48 | $root->bindSingleton(LoggerInterface::class, FileLogger::class); |
47 | 49 | |
48 | 50 | $obj2 = null; |
49 | - $obj = $root->runScoped(static function (Container $c1) use (&$obj2) { |
|
50 | - $obj = $c1->runScoped(static function (Container $c2) use (&$obj2) { |
|
51 | + $obj = $root->runScoped(static function (Container $c1) use (&$obj2) |
|
52 | + { |
|
53 | + $obj = $c1->runScoped(static function (Container $c2) use (&$obj2) |
|
54 | + { |
|
51 | 55 | $obj = $c2->get(AttrScopeFooFinalize::class); |
52 | 56 | $obj2 = $c2->get(AttrScopeFooFinalize::class); |
53 | 57 | |
@@ -77,8 +81,10 @@ discard block |
||
77 | 81 | $root->bindSingleton(LoggerInterface::class, FileLogger::class); |
78 | 82 | |
79 | 83 | $obj2 = null; |
80 | - $obj = $root->runScoped(static function (Container $c1) use (&$obj2) { |
|
81 | - $obj = $c1->runScoped(static function (Container $c2) use (&$obj2) { |
|
84 | + $obj = $root->runScoped(static function (Container $c1) use (&$obj2) |
|
85 | + { |
|
86 | + $obj = $c1->runScoped(static function (Container $c2) use (&$obj2) |
|
87 | + { |
|
82 | 88 | $obj = $c2->get(AttrFinalize::class); |
83 | 89 | $obj2 = $c2->get(AttrFinalize::class); |
84 | 90 | |
@@ -124,12 +130,15 @@ discard block |
||
124 | 130 | self::expectException(FinalizersException::class); |
125 | 131 | self::expectExceptionMessage('An exception has been thrown during finalization of the scope `foo`'); |
126 | 132 | |
127 | - try { |
|
133 | + try |
|
134 | + { |
|
128 | 135 | $root->runScoped(static function (Container $c1): void { |
129 | 136 | $obj = $c1->get(AttrScopeFooFinalize::class); |
130 | 137 | $obj->throwException = true; |
131 | 138 | }, name: 'foo'); |
132 | - } catch (FinalizersException $e) { |
|
139 | + } |
|
140 | + catch (FinalizersException $e) |
|
141 | + { |
|
133 | 142 | self::assertSame('foo', $e->getScope()); |
134 | 143 | self::assertCount(1, $e->getExceptions()); |
135 | 144 | // Contains the message from the inner exception. |
@@ -153,13 +162,16 @@ discard block |
||
153 | 162 | self::expectException(FinalizersException::class); |
154 | 163 | self::expectExceptionMessage('3 exceptions have been thrown during finalization of the scope `foo`'); |
155 | 164 | |
156 | - try { |
|
165 | + try |
|
166 | + { |
|
157 | 167 | $root->runScoped(static function (Container $c1): void { |
158 | 168 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
159 | 169 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
160 | 170 | $c1->get(AttrScopeFooFinalize::class)->throwException = true; |
161 | 171 | }, name: 'foo'); |
162 | - } catch (FinalizersException $e) { |
|
172 | + } |
|
173 | + catch (FinalizersException $e) |
|
174 | + { |
|
163 | 175 | self::assertSame('foo', $e->getScope()); |
164 | 176 | self::assertCount(3, $e->getExceptions()); |
165 | 177 | // Contains the message from the inner exception. |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | $root = self::makeContainer(); |
167 | 167 | |
168 | - try { |
|
168 | + try{ |
|
169 | 169 | $root->runScoped(static function (Container $c1): void { |
170 | 170 | $c1->runScoped(static function (Container $c2): void { |
171 | 171 | $c2->runScoped(static function (Container $c3): void { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | }, name: 'root'); |
174 | 174 | }); |
175 | 175 | }); |
176 | - } catch (NamedScopeDuplicationException $e) { |
|
176 | + }catch (NamedScopeDuplicationException $e){ |
|
177 | 177 | self::assertSame('root', $e->getScope()); |
178 | 178 | throw $e; |
179 | 179 | } |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | { |
189 | 189 | self::expectException(BadScopeException::class); |
190 | 190 | |
191 | - try { |
|
191 | + try{ |
|
192 | 192 | $root = self::makeContainer(); |
193 | 193 | $root->runScoped(static function (Container $c1): void { |
194 | 194 | $c1->runScoped(static function (Container $c2): void { |
195 | 195 | $c2->get(AttrScopeFoo::class); |
196 | 196 | }); |
197 | 197 | }, name: 'bar'); |
198 | - } catch (BadScopeException $e) { |
|
198 | + }catch (BadScopeException $e){ |
|
199 | 199 | self::assertSame('foo', $e->getScope()); |
200 | 200 | throw $e; |
201 | 201 | } |
@@ -165,7 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | $root = self::makeContainer(); |
167 | 167 | |
168 | - try { |
|
168 | + try |
|
169 | + { |
|
169 | 170 | $root->runScoped(static function (Container $c1): void { |
170 | 171 | $c1->runScoped(static function (Container $c2): void { |
171 | 172 | $c2->runScoped(static function (Container $c3): void { |
@@ -173,7 +174,9 @@ discard block |
||
173 | 174 | }, name: 'root'); |
174 | 175 | }); |
175 | 176 | }); |
176 | - } catch (NamedScopeDuplicationException $e) { |
|
177 | + } |
|
178 | + catch (NamedScopeDuplicationException $e) |
|
179 | + { |
|
177 | 180 | self::assertSame('root', $e->getScope()); |
178 | 181 | throw $e; |
179 | 182 | } |
@@ -188,14 +191,17 @@ discard block |
||
188 | 191 | { |
189 | 192 | self::expectException(BadScopeException::class); |
190 | 193 | |
191 | - try { |
|
194 | + try |
|
195 | + { |
|
192 | 196 | $root = self::makeContainer(); |
193 | 197 | $root->runScoped(static function (Container $c1): void { |
194 | 198 | $c1->runScoped(static function (Container $c2): void { |
195 | 199 | $c2->get(AttrScopeFoo::class); |
196 | 200 | }); |
197 | 201 | }, name: 'bar'); |
198 | - } catch (BadScopeException $e) { |
|
202 | + } |
|
203 | + catch (BadScopeException $e) |
|
204 | + { |
|
199 | 205 | self::assertSame('foo', $e->getScope()); |
200 | 206 | throw $e; |
201 | 207 | } |