@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $this->bindSingleton(DateTimeInterface::class, $time = new DateTimeImmutable()); |
| 21 | 21 | |
| 22 | 22 | $result = $this->resolveClosure( |
| 23 | - static fn(string|DateTimeInterface $time) => null, |
|
| 23 | + static fn(string | DateTimeInterface $time) => null, |
|
| 24 | 24 | [] |
| 25 | 25 | ); |
| 26 | 26 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function testUnionType(): void |
| 126 | 126 | { |
| 127 | 127 | $this->validateClosureArguments( |
| 128 | - fn (array|Traversable $a, array|Traversable $b) => null, |
|
| 128 | + fn (array | Traversable $a, array | Traversable $b) => null, |
|
| 129 | 129 | [[1, 2, NAN], new EmptyIterator()] |
| 130 | 130 | ); |
| 131 | 131 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public function testNullableUnionType(): void |
| 134 | 134 | { |
| 135 | 135 | $this->validateClosureArguments( |
| 136 | - fn (null|array|Traversable $a, null|array|Traversable $b) => null, |
|
| 136 | + fn (null | array | Traversable $a, null | array | Traversable $b) => null, |
|
| 137 | 137 | [null, new EmptyIterator()] |
| 138 | 138 | ); |
| 139 | 139 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function testWrongUnionType(): void |
| 197 | 197 | { |
| 198 | 198 | $this->validateClosureArguments( |
| 199 | - fn (array|Traversable $a) => null, |
|
| 199 | + fn (array | Traversable $a) => null, |
|
| 200 | 200 | ['foo'], |
| 201 | 201 | 'a' |
| 202 | 202 | ); |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | ?string $invalidParameter = null, |
| 330 | 330 | string $exceptionClass = InvalidArgumentException::class, |
| 331 | 331 | ): void { |
| 332 | - try { |
|
| 332 | + try{ |
|
| 333 | 333 | $this->createResolver()->validateArguments(new ReflectionFunction($closure), $arguments); |
| 334 | - } catch (ValidationException $e) { |
|
| 334 | + }catch (ValidationException $e){ |
|
| 335 | 335 | $this->assertInstanceOf($exceptionClass, $e, 'Expected other exception.'); |
| 336 | - if ($invalidParameter === null) { |
|
| 336 | + if ($invalidParameter === null){ |
|
| 337 | 337 | throw $e; |
| 338 | 338 | } |
| 339 | - if ($e->getParameter() !== $invalidParameter) { |
|
| 339 | + if ($e->getParameter() !== $invalidParameter){ |
|
| 340 | 340 | $this->fail( |
| 341 | 341 | \sprintf( |
| 342 | 342 | 'The other argument has been failed: `%s` instead of `%s`.', |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $this->assertTrue(true, 'Invalid value has been failed.'); |
| 349 | 349 | return; |
| 350 | 350 | } |
| 351 | - if ($invalidParameter === null) { |
|
| 351 | + if ($invalidParameter === null){ |
|
| 352 | 352 | $this->assertTrue(true, 'Valid argument value has been failed.'); |
| 353 | 353 | return; |
| 354 | 354 | } |
@@ -329,14 +329,19 @@ discard block |
||
| 329 | 329 | ?string $invalidParameter = null, |
| 330 | 330 | string $exceptionClass = InvalidArgumentException::class, |
| 331 | 331 | ): void { |
| 332 | - try { |
|
| 332 | + try |
|
| 333 | + { |
|
| 333 | 334 | $this->createResolver()->validateArguments(new ReflectionFunction($closure), $arguments); |
| 334 | - } catch (ValidationException $e) { |
|
| 335 | + } |
|
| 336 | + catch (ValidationException $e) |
|
| 337 | + { |
|
| 335 | 338 | $this->assertInstanceOf($exceptionClass, $e, 'Expected other exception.'); |
| 336 | - if ($invalidParameter === null) { |
|
| 339 | + if ($invalidParameter === null) |
|
| 340 | + { |
|
| 337 | 341 | throw $e; |
| 338 | 342 | } |
| 339 | - if ($e->getParameter() !== $invalidParameter) { |
|
| 343 | + if ($e->getParameter() !== $invalidParameter) |
|
| 344 | + { |
|
| 340 | 345 | $this->fail( |
| 341 | 346 | \sprintf( |
| 342 | 347 | 'The other argument has been failed: `%s` instead of `%s`.', |
@@ -348,7 +353,8 @@ discard block |
||
| 348 | 353 | $this->assertTrue(true, 'Invalid value has been failed.'); |
| 349 | 354 | return; |
| 350 | 355 | } |
| 351 | - if ($invalidParameter === null) { |
|
| 356 | + if ($invalidParameter === null) |
|
| 357 | + { |
|
| 352 | 358 | $this->assertTrue(true, 'Valid argument value has been failed.'); |
| 353 | 359 | return; |
| 354 | 360 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | public function testNullableUnionDefaultScalar(): void |
| 84 | 84 | { |
| 85 | 85 | $result = $this->resolveClosure( |
| 86 | - static fn(null|int|string $param = 42) => $param |
|
| 86 | + static fn(null | int | string $param = 42) => $param |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | $this->assertSame([42], $result); |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function testInternalServicesDontBlockContainer(): void |
| 14 | 14 | { |
| 15 | - (static function () { |
|
| 15 | + (static function (){ |
|
| 16 | 16 | $container = new Container(); |
| 17 | 17 | $finalizer = new class { |
| 18 | 18 | public ?\Closure $closure = null; |
| 19 | 19 | public function __destruct() |
| 20 | 20 | { |
| 21 | - if ($this->closure !== null) { |
|
| 21 | + if ($this->closure !== null){ |
|
| 22 | 22 | ($this->closure)(); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -12,18 +12,22 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function testInternalServicesDontBlockContainer(): void |
| 14 | 14 | { |
| 15 | - (static function () { |
|
| 15 | + (static function () |
|
| 16 | + { |
|
| 16 | 17 | $container = new Container(); |
| 17 | - $finalizer = new class { |
|
| 18 | + $finalizer = new class |
|
| 19 | + { |
|
| 18 | 20 | public ?\Closure $closure = null; |
| 19 | 21 | public function __destruct() |
| 20 | 22 | { |
| 21 | - if ($this->closure !== null) { |
|
| 23 | + if ($this->closure !== null) |
|
| 24 | + { |
|
| 22 | 25 | ($this->closure)(); |
| 23 | 26 | } |
| 24 | 27 | } |
| 25 | 28 | }; |
| 26 | - $finalizer->closure = static function () use ($container) { |
|
| 29 | + $finalizer->closure = static function () use ($container) |
|
| 30 | + { |
|
| 27 | 31 | $container->hasInstance('finalizer'); |
| 28 | 32 | }; |
| 29 | 33 | $container->bind('finalizer', $finalizer); |
@@ -36,9 +36,9 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $map = new WeakMap(); |
| 38 | 38 | |
| 39 | - $fn = function (WeakMap $map) { |
|
| 40 | - foreach ($this as $key => $value) { |
|
| 41 | - if (\is_object($value)) { |
|
| 39 | + $fn = function (WeakMap $map){ |
|
| 40 | + foreach ($this as $key => $value){ |
|
| 41 | + if (\is_object($value)){ |
|
| 42 | 42 | $map->offsetSet($value, $key); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -36,9 +36,12 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $map = new WeakMap(); |
| 38 | 38 | |
| 39 | - $fn = function (WeakMap $map) { |
|
| 40 | - foreach ($this as $key => $value) { |
|
| 41 | - if (\is_object($value)) { |
|
| 39 | + $fn = function (WeakMap $map) |
|
| 40 | + { |
|
| 41 | + foreach ($this as $key => $value) |
|
| 42 | + { |
|
| 43 | + if (\is_object($value)) |
|
| 44 | + { |
|
| 42 | 45 | $map->offsetSet($value, $key); |
| 43 | 46 | } |
| 44 | 47 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | public function testClosureFactory(): void |
| 87 | 87 | { |
| 88 | - $this->bind(Bucket::class, function ($data) { |
|
| 88 | + $this->bind(Bucket::class, function ($data){ |
|
| 89 | 89 | return new Bucket('via-closure', $data); |
| 90 | 90 | }); |
| 91 | 91 | |
@@ -88,7 +88,8 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function testClosureFactory(): void |
| 90 | 90 | { |
| 91 | - $this->bind(Bucket::class, function ($data) { |
|
| 91 | + $this->bind(Bucket::class, function ($data) |
|
| 92 | + { |
|
| 92 | 93 | return new Bucket('via-closure', $data); |
| 93 | 94 | }); |
| 94 | 95 | |
@@ -128,7 +129,8 @@ discard block |
||
| 128 | 129 | $sample = new SampleClass(); |
| 129 | 130 | |
| 130 | 131 | $this->bind(Bucket::class, [Factory::class, 'makeBucketWithSample']); |
| 131 | - $this->bind(SampleClass::class, function () use ($sample) { |
|
| 132 | + $this->bind(SampleClass::class, function () use ($sample) |
|
| 133 | + { |
|
| 132 | 134 | return $sample; |
| 133 | 135 | }); |
| 134 | 136 | |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | public bool $bool, |
| 14 | 14 | public array $array = [], |
| 15 | 15 | public ?string $pong = null |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct( |
| 10 | 10 | public LightEngine $engine |
| 11 | - ) { |
|
| 11 | + ){ |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function __call(string $name, array $arguments) |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct( |
| 12 | 12 | private object $object = new stdClass() |
| 13 | - ) { |
|
| 13 | + ){ |
|
| 14 | 14 | } |
| 15 | 15 | } |