@@ -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 |
@@ -62,17 +62,22 @@ discard block |
||
62 | 62 | |
63 | 63 | public static function provideRenderMethod(): iterable |
64 | 64 | { |
65 | - $class = new class { |
|
65 | + $class = new class |
|
66 | + { |
|
66 | 67 | public const INT_CONST = 42; |
67 | 68 | |
68 | 69 | #[ExpectedAttribute('public function test1(...$variadic)')] |
69 | - public function test1(...$variadic) {} |
|
70 | + public function test1(...$variadic) |
|
71 | + { |
|
72 | +} |
|
70 | 73 | |
71 | 74 | #[ExpectedAttribute('public function test2(mixed $string = self::INT_CONST): string|int')] |
72 | 75 | public function test2(string|int $string = self::INT_CONST): string|int {} |
73 | 76 | |
74 | 77 | #[ExpectedAttribute('public function test3(mixed $obj = new \stdClass(new \stdClass(), new \stdClass()))')] |
75 | - public function test3(object $obj = new \stdClass(new \stdClass(), new \stdClass())) {} |
|
78 | + public function test3(object $obj = new \stdClass(new \stdClass(), new \stdClass())) |
|
79 | + { |
|
80 | +} |
|
76 | 81 | |
77 | 82 | #[ExpectedAttribute('public function test4(): \\' . ProxyClassRendererTest::class)] |
78 | 83 | public function test4(): ProxyClassRendererTest {} |
@@ -81,7 +86,8 @@ discard block |
||
81 | 86 | public function &test5(): string {} |
82 | 87 | }; |
83 | 88 | |
84 | - foreach ((new \ReflectionClass($class))->getMethods() as $method) { |
|
89 | + foreach ((new \ReflectionClass($class))->getMethods() as $method) |
|
90 | + { |
|
85 | 91 | $expected = $method->getAttributes(ExpectedAttribute::class)[0]->newInstance(); |
86 | 92 | |
87 | 93 | yield [$method, $expected->value]; |
@@ -174,5 +180,6 @@ discard block |
||
174 | 180 | { |
175 | 181 | public function __construct( |
176 | 182 | public readonly string $value, |
177 | - ) {} |
|
183 | + ) { |
|
184 | +} |
|
178 | 185 | } |
@@ -34,24 +34,24 @@ discard block |
||
34 | 34 | yield [$from(static fn(string $string = self::STRING_CONST) => 0), 'mixed $string = self::STRING_CONST']; |
35 | 35 | yield [ |
36 | 36 | $from(static fn(string $string = ProxyClassRendererTest::STRING_CONST) => 0), |
37 | - 'mixed $string = \\' . self::class . '::STRING_CONST', |
|
37 | + 'mixed $string = \\'.self::class.'::STRING_CONST', |
|
38 | 38 | ]; |
39 | - yield [$from(static fn(string|int $string = self::INT_CONST) => 0), 'mixed $string = self::INT_CONST']; |
|
39 | + yield [$from(static fn(string | int $string = self::INT_CONST) => 0), 'mixed $string = self::INT_CONST']; |
|
40 | 40 | yield [$from(static fn(mixed $string = 42) => 0), 'mixed $string = 42']; |
41 | 41 | yield [$from(static fn(int $string = 42) => 0), 'mixed $string = 42']; |
42 | 42 | yield [$from(static fn(float $string = 42) => 0), 'mixed $string = 42.0']; |
43 | 43 | yield [$from(static fn(?bool $string = false) => 0), 'mixed $string = false']; |
44 | - yield [$from(static fn(bool|null $string = true) => 0), 'mixed $string = true']; |
|
44 | + yield [$from(static fn(bool | null $string = true) => 0), 'mixed $string = true']; |
|
45 | 45 | yield [$from(static fn(?object $string = null) => 0), 'mixed $string = NULL']; |
46 | 46 | yield [$from(static fn(?iterable $string = null) => 0), 'mixed $string = NULL']; |
47 | 47 | yield [$from(static fn(\Countable&\ArrayAccess $val) => 0), 'mixed $val']; |
48 | 48 | yield [$from(static fn(string ...$val) => 0), 'mixed ...$val']; |
49 | - yield [$from(static fn(string|int ...$val) => 0), 'mixed ...$val']; |
|
50 | - yield [$from(static fn(string|int &$link) => 0), 'mixed &$link']; |
|
49 | + yield [$from(static fn(string | int ...$val) => 0), 'mixed ...$val']; |
|
50 | + yield [$from(static fn(string | int &$link) => 0), 'mixed &$link']; |
|
51 | 51 | yield [$from(self::withSelf(...)), 'mixed $self = new self()']; |
52 | 52 | yield [$from(static fn(object $link = new \stdClass()) => 0), 'mixed $link = new \stdClass()']; |
53 | 53 | yield [ |
54 | - $from(static fn(#[Proxy] float|int|\stdClass|null $string = new \stdClass(1, 2, bar: "\n'zero")) => 0), |
|
54 | + $from(static fn(#[Proxy] float | int | \stdClass | null $string = new \stdClass(1, 2, bar: "\n'zero")) => 0), |
|
55 | 55 | "mixed \$string = new \stdClass(1, 2, bar: '\n\'zero')", |
56 | 56 | ]; |
57 | 57 | yield [ |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | public const INT_CONST = 42; |
67 | 67 | |
68 | 68 | #[ExpectedAttribute('public function test1(...$variadic)')] |
69 | - public function test1(...$variadic) {} |
|
69 | + public function test1(...$variadic){} |
|
70 | 70 | |
71 | 71 | #[ExpectedAttribute('public function test2(mixed $string = self::INT_CONST): string|int')] |
72 | - public function test2(string|int $string = self::INT_CONST): string|int {} |
|
72 | + public function test2(string | int $string = self::INT_CONST): string | int {} |
|
73 | 73 | |
74 | 74 | #[ExpectedAttribute('public function test3(mixed $obj = new \stdClass(new \stdClass(), new \stdClass()))')] |
75 | - public function test3(object $obj = new \stdClass(new \stdClass(), new \stdClass())) {} |
|
75 | + public function test3(object $obj = new \stdClass(new \stdClass(), new \stdClass())){} |
|
76 | 76 | |
77 | - #[ExpectedAttribute('public function test4(): \\' . ProxyClassRendererTest::class)] |
|
77 | + #[ExpectedAttribute('public function test4(): \\'.ProxyClassRendererTest::class)] |
|
78 | 78 | public function test4(): ProxyClassRendererTest {} |
79 | 79 | |
80 | 80 | #[ExpectedAttribute('public function &test5(): string')] |
81 | 81 | public function &test5(): string {} |
82 | 82 | }; |
83 | 83 | |
84 | - foreach ((new \ReflectionClass($class))->getMethods() as $method) { |
|
84 | + foreach ((new \ReflectionClass($class))->getMethods() as $method){ |
|
85 | 85 | $expected = $method->getAttributes(ExpectedAttribute::class)[0]->newInstance(); |
86 | 86 | |
87 | 87 | yield [$method, $expected->value]; |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | $from = static fn(\Closure $closure): \ReflectionParameter => new \ReflectionParameter($closure, 0); |
97 | 97 | |
98 | 98 | yield [$from(static fn(string $string) => 0), 'string']; |
99 | - yield [$from(static fn(string|int $string) => 0), 'string|int']; |
|
99 | + yield [$from(static fn(string | int $string) => 0), 'string|int']; |
|
100 | 100 | yield [$from(static fn(mixed $string) => 0), 'mixed']; |
101 | 101 | yield [$from(static fn(int $string) => 0), 'int']; |
102 | 102 | yield [$from(static fn(float $string) => 0), 'float']; |
103 | 103 | yield [$from(static fn(?bool $string) => 0), '?bool']; |
104 | - yield [$from(static fn(bool|null $string) => 0), '?bool']; |
|
104 | + yield [$from(static fn(bool | null $string) => 0), '?bool']; |
|
105 | 105 | yield [$from(static fn(object $string) => 0), 'object']; |
106 | 106 | yield [$from(static fn(iterable $string) => 0), 'iterable']; |
107 | 107 | yield [$from(static fn(\Countable&\ArrayAccess $val) => 0), '\Countable&\ArrayAccess']; |
108 | 108 | yield [$from(static fn(string ...$val) => 0), 'string']; |
109 | - yield [$from(static fn(string|int ...$val) => 0), 'string|int']; |
|
110 | - yield [$from(static fn(string|int &$link) => 0), 'string|int']; |
|
111 | - yield [$from(self::withSelf(...)), '\\' . self::class]; |
|
109 | + yield [$from(static fn(string | int ...$val) => 0), 'string|int']; |
|
110 | + yield [$from(static fn(string | int &$link) => 0), 'string|int']; |
|
111 | + yield [$from(self::withSelf(...)), '\\'.self::class]; |
|
112 | 112 | yield [$from(static fn(object $link) => 0), 'object']; |
113 | - yield [$from(static fn(#[Proxy] float|int|\stdClass|null $string) => 0), '\stdClass|int|float|null']; |
|
114 | - yield [$from(static fn(SimpleEnum $val) => 0), '\\' . SimpleEnum::class]; |
|
113 | + yield [$from(static fn(#[Proxy] float | int | \stdClass | null $string) => 0), '\stdClass|int|float|null']; |
|
114 | + yield [$from(static fn(SimpleEnum $val) => 0), '\\'.SimpleEnum::class]; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | public function testInterfaceWithConstructor(): void |
@@ -174,5 +174,5 @@ discard block |
||
174 | 174 | { |
175 | 175 | public function __construct( |
176 | 176 | public readonly string $value, |
177 | - ) {} |
|
177 | + ){} |
|
178 | 178 | } |