@@ -20,18 +20,18 @@ |
||
20 | 20 | |
21 | 21 | public function __construct( |
22 | 22 | private readonly LogsInterface $factory, |
23 | - ) {} |
|
23 | + ){} |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param \ReflectionParameter|string|null $context may use extended context if possible. |
27 | 27 | */ |
28 | 28 | public function createInjection( |
29 | 29 | \ReflectionClass $class, |
30 | - \ReflectionParameter|null|string $context = null, |
|
30 | + \ReflectionParameter | null | string $context = null, |
|
31 | 31 | ): LoggerInterface { |
32 | 32 | $channel = \is_object($context) ? $this->extractChannelAttribute($context) : null; |
33 | 33 | |
34 | - if ($channel === null) { |
|
34 | + if ($channel === null){ |
|
35 | 35 | /** |
36 | 36 | * Array of flags to check if the logger allows null argument |
37 | 37 | * |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct( |
22 | 22 | private readonly LogsInterface $factory, |
23 | - ) {} |
|
23 | + ) { |
|
24 | +} |
|
24 | 25 | |
25 | 26 | /** |
26 | 27 | * @param \ReflectionParameter|string|null $context may use extended context if possible. |
@@ -31,7 +32,8 @@ discard block |
||
31 | 32 | ): LoggerInterface { |
32 | 33 | $channel = \is_object($context) ? $this->extractChannelAttribute($context) : null; |
33 | 34 | |
34 | - if ($channel === null) { |
|
35 | + if ($channel === null) |
|
36 | + { |
|
35 | 37 | /** |
36 | 38 | * Array of flags to check if the logger allows null argument |
37 | 39 | * |
@@ -12,7 +12,7 @@ |
||
12 | 12 | private readonly string $level, |
13 | 13 | private readonly string $message, |
14 | 14 | private readonly array $context = [], |
15 | - ) {} |
|
15 | + ){} |
|
16 | 16 | |
17 | 17 | public function getTime(): \DateTimeInterface |
18 | 18 | { |
@@ -12,7 +12,8 @@ |
||
12 | 12 | private readonly string $level, |
13 | 13 | private readonly string $message, |
14 | 14 | private readonly array $context = [], |
15 | - ) {} |
|
15 | + ) { |
|
16 | +} |
|
16 | 17 | |
17 | 18 | public function getTime(): \DateTimeInterface |
18 | 19 | { |
@@ -17,5 +17,5 @@ |
||
17 | 17 | /** |
18 | 18 | * @param non-empty-string $name |
19 | 19 | */ |
20 | - public function __construct(public readonly string $name) {} |
|
20 | + public function __construct(public readonly string $name){} |
|
21 | 21 | } |
@@ -17,5 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @param non-empty-string $name |
19 | 19 | */ |
20 | - public function __construct(public readonly string $name) {} |
|
20 | + public function __construct(public readonly string $name) |
|
21 | + { |
|
22 | +} |
|
21 | 23 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | public function __construct( |
16 | 16 | private readonly ListenerRegistryInterface $listenedRegistry, |
17 | - ) {} |
|
17 | + ){} |
|
18 | 18 | |
19 | 19 | public function getLogger(string $channel): LoggerInterface |
20 | 20 | { |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | $e = new LogEvent( |
27 | 27 | new \DateTime(), |
28 | 28 | $channel, |
29 | - (string) $level, |
|
29 | + (string)$level, |
|
30 | 30 | $message, |
31 | 31 | $context, |
32 | 32 | ); |
33 | 33 | |
34 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
34 | + foreach ($this->listenedRegistry->getListeners() as $listener){ |
|
35 | 35 | \call_user_func($listener, $e); |
36 | 36 | } |
37 | 37 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | { |
15 | 15 | public function __construct( |
16 | 16 | private readonly ListenerRegistryInterface $listenedRegistry, |
17 | - ) {} |
|
17 | + ) { |
|
18 | +} |
|
18 | 19 | |
19 | 20 | public function getLogger(string $channel): LoggerInterface |
20 | 21 | { |
@@ -31,7 +32,8 @@ discard block |
||
31 | 32 | $context, |
32 | 33 | ); |
33 | 34 | |
34 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
35 | + foreach ($this->listenedRegistry->getListeners() as $listener) |
|
36 | + { |
|
35 | 37 | \call_user_func($listener, $e); |
36 | 38 | } |
37 | 39 | } |
@@ -324,14 +324,19 @@ discard block |
||
324 | 324 | ?string $invalidParameter = null, |
325 | 325 | string $exceptionClass = InvalidArgumentException::class, |
326 | 326 | ): void { |
327 | - try { |
|
327 | + try |
|
328 | + { |
|
328 | 329 | $this->createResolver()->validateArguments(new \ReflectionFunction($closure), $arguments); |
329 | - } catch (ValidationException $e) { |
|
330 | + } |
|
331 | + catch (ValidationException $e) |
|
332 | + { |
|
330 | 333 | $this->assertInstanceOf($exceptionClass, $e, 'Expected other exception.'); |
331 | - if ($invalidParameter === null) { |
|
334 | + if ($invalidParameter === null) |
|
335 | + { |
|
332 | 336 | throw $e; |
333 | 337 | } |
334 | - if ($e->getParameter() !== $invalidParameter) { |
|
338 | + if ($e->getParameter() !== $invalidParameter) |
|
339 | + { |
|
335 | 340 | $this->fail( |
336 | 341 | \sprintf( |
337 | 342 | 'The other argument has been failed: `%s` instead of `%s`.', |
@@ -343,7 +348,8 @@ discard block |
||
343 | 348 | $this->assertTrue(true, 'Invalid value has been failed.'); |
344 | 349 | return; |
345 | 350 | } |
346 | - if ($invalidParameter === null) { |
|
351 | + if ($invalidParameter === null) |
|
352 | + { |
|
347 | 353 | $this->assertTrue(true, 'Valid argument value has been failed.'); |
348 | 354 | return; |
349 | 355 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function testUnionType(): void |
120 | 120 | { |
121 | 121 | $this->validateClosureArguments( |
122 | - static fn(array|\Traversable $a, array|\Traversable $b) => null, |
|
122 | + static fn(array | \Traversable $a, array | \Traversable $b) => null, |
|
123 | 123 | [[1, 2, NAN], new \EmptyIterator()], |
124 | 124 | ); |
125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function testNullableUnionType(): void |
128 | 128 | { |
129 | 129 | $this->validateClosureArguments( |
130 | - static fn(null|array|\Traversable $a, null|array|\Traversable $b) => null, |
|
130 | + static fn(null | array | \Traversable $a, null | array | \Traversable $b) => null, |
|
131 | 131 | [null, new \EmptyIterator()], |
132 | 132 | ); |
133 | 133 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | public function testWrongUnionType(): void |
191 | 191 | { |
192 | 192 | $this->validateClosureArguments( |
193 | - static fn(array|\Traversable $a) => null, |
|
193 | + static fn(array | \Traversable $a) => null, |
|
194 | 194 | ['foo'], |
195 | 195 | 'a', |
196 | 196 | ); |
@@ -324,14 +324,14 @@ discard block |
||
324 | 324 | ?string $invalidParameter = null, |
325 | 325 | string $exceptionClass = InvalidArgumentException::class, |
326 | 326 | ): void { |
327 | - try { |
|
327 | + try{ |
|
328 | 328 | $this->createResolver()->validateArguments(new \ReflectionFunction($closure), $arguments); |
329 | - } catch (ValidationException $e) { |
|
329 | + }catch (ValidationException $e){ |
|
330 | 330 | $this->assertInstanceOf($exceptionClass, $e, 'Expected other exception.'); |
331 | - if ($invalidParameter === null) { |
|
331 | + if ($invalidParameter === null){ |
|
332 | 332 | throw $e; |
333 | 333 | } |
334 | - if ($e->getParameter() !== $invalidParameter) { |
|
334 | + if ($e->getParameter() !== $invalidParameter){ |
|
335 | 335 | $this->fail( |
336 | 336 | \sprintf( |
337 | 337 | 'The other argument has been failed: `%s` instead of `%s`.', |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $this->assertTrue(true, 'Invalid value has been failed.'); |
344 | 344 | return; |
345 | 345 | } |
346 | - if ($invalidParameter === null) { |
|
346 | + if ($invalidParameter === null){ |
|
347 | 347 | $this->assertTrue(true, 'Valid argument value has been failed.'); |
348 | 348 | return; |
349 | 349 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | public function testNullableUnionDefaultScalar(): void |
82 | 82 | { |
83 | 83 | $result = $this->resolveClosure( |
84 | - static fn(null|int|string $param = 42) => $param, |
|
84 | + static fn(null | int | string $param = 42) => $param, |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | $this->assertSame([42], $result); |
@@ -105,7 +105,7 @@ |
||
105 | 105 | new \DateTimeImmutable(), |
106 | 106 | new EngineVAZ2101(), |
107 | 107 | ], |
108 | - validate: false, |
|
108 | + validate : false, |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | $this->assertCount(2, $result); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $fiz = new \DateTime(); |
20 | 20 | |
21 | 21 | $result = $this->resolveClosure( |
22 | - static fn(DateTimeInterface &...$dates) => $dates, |
|
22 | + static fn(DateTimeInterface & ...$dates) => $dates, |
|
23 | 23 | [[$foo, &$bar, &$baz, $fiz]], |
24 | 24 | ); |
25 | 25 | $this->assertCount(4, $result); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $fiz = new \DateTime(); |
49 | 49 | |
50 | 50 | $result = $this->resolveClosure( |
51 | - static fn(DateTimeInterface &...$dates) => $dates, |
|
51 | + static fn(DateTimeInterface & ...$dates) => $dates, |
|
52 | 52 | ['dates' => [$foo, &$bar, &$baz, $fiz]], |
53 | 53 | ); |
54 | 54 | $this->assertCount(4, $result); |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | int &$foo, |
87 | 87 | object &$bar, |
88 | 88 | &$baz, |
89 | - ?ColorInterface &$nullable, |
|
90 | - EngineInterface &$object, // from container |
|
91 | - DateTimeInterface &...$dates, // collect all unnamed DateTimeInterface objects |
|
89 | + ?ColorInterface & $nullable, |
|
90 | + EngineInterface & $object, // from container |
|
91 | + DateTimeInterface & ...$dates, // collect all unnamed DateTimeInterface objects |
|
92 | 92 | ) => null, |
93 | 93 | [ |
94 | 94 | 'dates' => [ |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $this->bindSingleton(\DateTimeInterface::class, $time = new \DateTimeImmutable()); |
18 | 18 | |
19 | 19 | $result = $this->resolveClosure( |
20 | - static fn(string|\DateTimeInterface $time) => null, |
|
20 | + static fn(string | \DateTimeInterface $time) => null, |
|
21 | 21 | [], |
22 | 22 | ); |
23 | 23 |