@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function __construct( |
| 13 | 13 | string $scope, |
| 14 | 14 | protected string $className, |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | parent::__construct( |
| 17 | 17 | $scope, |
| 18 | 18 | \sprintf('Class `%s` can be resolved only in `%s` scope.', $className, $scope), |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | ?string $scope, |
| 15 | 15 | array $parents, |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $scopes = \implode('->', \array_map( |
| 18 | - static fn(?string $scope): string => $scope === null ? 'null' : "\"$scope\"", |
|
| 18 | + static fn(?string $scope) : string => $scope === null ? 'null' : "\"$scope\"", |
|
| 19 | 19 | [...\array_reverse($parents), $scope], |
| 20 | 20 | )); |
| 21 | 21 | parent::__construct( |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | string $message = '', |
| 17 | 17 | int $code = 0, |
| 18 | 18 | ?\Throwable $previous = null, |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | parent::__construct( |
| 21 | 21 | $message, |
| 22 | 22 | $code, |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public readonly string $binder = Binder::class, |
| 51 | 51 | public readonly string $invoker = Invoker::class, |
| 52 | 52 | public readonly string $tracer = Tracer::class, |
| 53 | - ) { |
|
| 53 | + ){ |
|
| 54 | 54 | $this->scope = Scope::class; |
| 55 | 55 | $this->scopedBindings = new Internal\Config\StateStorage(); |
| 56 | 56 | } |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function lockRoot(): bool |
| 76 | 76 | { |
| 77 | - try { |
|
| 77 | + try{ |
|
| 78 | 78 | return $this->rootLocked; |
| 79 | - } finally { |
|
| 79 | + }finally{ |
|
| 80 | 80 | $this->rootLocked = false; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -74,9 +74,12 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function lockRoot(): bool |
| 76 | 76 | { |
| 77 | - try { |
|
| 77 | + try |
|
| 78 | + { |
|
| 78 | 79 | return $this->rootLocked; |
| 79 | - } finally { |
|
| 80 | + } |
|
| 81 | + finally |
|
| 82 | + { |
|
| 80 | 83 | $this->rootLocked = false; |
| 81 | 84 | } |
| 82 | 85 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $listener = \Mockery::mock(TokenizationListenerInterface::class); |
| 32 | 32 | |
| 33 | - foreach ($classes as $class) { |
|
| 33 | + foreach ($classes as $class){ |
|
| 34 | 34 | $listener->shouldReceive('listen') |
| 35 | 35 | ->once() |
| 36 | 36 | ->with($class); |
@@ -30,7 +30,8 @@ |
||
| 30 | 30 | |
| 31 | 31 | $listener = \Mockery::mock(TokenizationListenerInterface::class); |
| 32 | 32 | |
| 33 | - foreach ($classes as $class) { |
|
| 33 | + foreach ($classes as $class) |
|
| 34 | + { |
|
| 34 | 35 | $listener->shouldReceive('listen') |
| 35 | 36 | ->once() |
| 36 | 37 | ->with($class); |
@@ -32,9 +32,12 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $target = new \ReflectionClass($this->class); |
| 34 | 34 | |
| 35 | - foreach ($classes as $class) { |
|
| 36 | - if (!$target->isTrait()) { |
|
| 37 | - if ($class->isSubclassOf($target) || $class->getName() === $target->getName()) { |
|
| 35 | + foreach ($classes as $class) |
|
| 36 | + { |
|
| 37 | + if (!$target->isTrait()) |
|
| 38 | + { |
|
| 39 | + if ($class->isSubclassOf($target) || $class->getName() === $target->getName()) |
|
| 40 | + { |
|
| 38 | 41 | yield $class->getName(); |
| 39 | 42 | } |
| 40 | 43 | |
@@ -42,7 +45,8 @@ discard block |
||
| 42 | 45 | } |
| 43 | 46 | |
| 44 | 47 | // Checking using traits |
| 45 | - if (\in_array($target->getName(), $this->fetchTraits($class->getName()), true)) { |
|
| 48 | + if (\in_array($target->getName(), $this->fetchTraits($class->getName()), true)) |
|
| 49 | + { |
|
| 46 | 50 | yield $class->getName(); |
| 47 | 51 | } |
| 48 | 52 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function __construct( |
| 25 | 25 | private readonly string $class, |
| 26 | 26 | ?string $scope = null, |
| 27 | - ) { |
|
| 27 | + ){ |
|
| 28 | 28 | parent::__construct($scope); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $target = new \ReflectionClass($this->class); |
| 34 | 34 | |
| 35 | - foreach ($classes as $class) { |
|
| 36 | - if (!$target->isTrait()) { |
|
| 37 | - if ($class->isSubclassOf($target) || $class->getName() === $target->getName()) { |
|
| 35 | + foreach ($classes as $class){ |
|
| 36 | + if (!$target->isTrait()){ |
|
| 37 | + if ($class->isSubclassOf($target) || $class->getName() === $target->getName()){ |
|
| 38 | 38 | yield $class->getName(); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Checking using traits |
| 45 | - if (\in_array($target->getName(), $this->fetchTraits($class->getName()), true)) { |
|
| 45 | + if (\in_array($target->getName(), $this->fetchTraits($class->getName()), true)){ |
|
| 46 | 46 | yield $class->getName(); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -32,7 +32,8 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function listen(\ReflectionClass $class): void |
| 34 | 34 | { |
| 35 | - if (!$this->isTargeted($class, $this->target)) { |
|
| 35 | + if (!$this->isTargeted($class, $this->target)) |
|
| 36 | + { |
|
| 36 | 37 | return; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -41,8 +42,10 @@ discard block |
||
| 41 | 42 | |
| 42 | 43 | public function finalize(): void |
| 43 | 44 | { |
| 44 | - foreach ($this->commands as $class) { |
|
| 45 | - if ($class->isAbstract()) { |
|
| 45 | + foreach ($this->commands as $class) |
|
| 46 | + { |
|
| 47 | + if ($class->isAbstract()) |
|
| 48 | + { |
|
| 46 | 49 | continue; |
| 47 | 50 | } |
| 48 | 51 | |
@@ -55,7 +58,8 @@ discard block |
||
| 55 | 58 | */ |
| 56 | 59 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
| 57 | 60 | { |
| 58 | - if (!$target->isTrait()) { |
|
| 61 | + if (!$target->isTrait()) |
|
| 62 | + { |
|
| 59 | 63 | // Target is interface or class |
| 60 | 64 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
| 61 | 65 | } |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | public function __construct( |
| 27 | 27 | private readonly ConsoleBootloader $bootloader, |
| 28 | 28 | ContainerInterface $container, |
| 29 | - ) { |
|
| 29 | + ){ |
|
| 30 | 30 | $this->container = $container; |
| 31 | 31 | $this->target = new \ReflectionClass(SymfonyCommand::class); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function listen(\ReflectionClass $class): void |
| 35 | 35 | { |
| 36 | - if (!$this->isTargeted($class, $this->target)) { |
|
| 36 | + if (!$this->isTargeted($class, $this->target)){ |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function finalize(): void |
| 44 | 44 | { |
| 45 | - foreach ($this->commands as $class) { |
|
| 46 | - if ($class->isAbstract()) { |
|
| 45 | + foreach ($this->commands as $class){ |
|
| 46 | + if ($class->isAbstract()){ |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
| 58 | 58 | { |
| 59 | - if (!$target->isTrait()) { |
|
| 59 | + if (!$target->isTrait()){ |
|
| 60 | 60 | // Target is interface or class |
| 61 | 61 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
| 62 | 62 | } |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | use MockeryPHPUnitIntegration; |
| 19 | 19 | |
| 20 | 20 | private ClassLocatorByTarget $locator; |
| 21 | - private ClassesInterface|m\LegacyMockInterface|m\MockInterface $classes; |
|
| 22 | - private ScopedClassesInterface|m\LegacyMockInterface|m\MockInterface $scopedClasses; |
|
| 21 | + private ClassesInterface | m\LegacyMockInterface | m\MockInterface $classes; |
|
| 22 | + private ScopedClassesInterface | m\LegacyMockInterface | m\MockInterface $scopedClasses; |
|
| 23 | 23 | |
| 24 | 24 | protected function setUp(): void |
| 25 | 25 | { |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | $attr = $attr->getAttributes()[0]; |
| 111 | 111 | $attribute = $attr->newInstance(); |
| 112 | 112 | |
| 113 | - if ($attribute->getScope() === null) { |
|
| 113 | + if ($attribute->getScope() === null){ |
|
| 114 | 114 | $this->classes |
| 115 | 115 | ->shouldReceive('getClasses') |
| 116 | 116 | ->andReturn($classes); |
| 117 | - } else { |
|
| 117 | + }else{ |
|
| 118 | 118 | $this->scopedClasses |
| 119 | 119 | ->shouldReceive('getScopedClasses') |
| 120 | 120 | ->with($attribute->getScope()) |
@@ -110,11 +110,14 @@ |
||
| 110 | 110 | $attr = $attr->getAttributes()[0]; |
| 111 | 111 | $attribute = $attr->newInstance(); |
| 112 | 112 | |
| 113 | - if ($attribute->getScope() === null) { |
|
| 113 | + if ($attribute->getScope() === null) |
|
| 114 | + { |
|
| 114 | 115 | $this->classes |
| 115 | 116 | ->shouldReceive('getClasses') |
| 116 | 117 | ->andReturn($classes); |
| 117 | - } else { |
|
| 118 | + } |
|
| 119 | + else |
|
| 120 | + { |
|
| 118 | 121 | $this->scopedClasses |
| 119 | 122 | ->shouldReceive('getScopedClasses') |
| 120 | 123 | ->with($attribute->getScope()) |
@@ -8,7 +8,8 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct() |
| 10 | 10 | { |
| 11 | - $class = new class ('foo', 'bar') { |
|
| 11 | + $class = new class ('foo', 'bar') |
|
| 12 | + { |
|
| 12 | 13 | private function someFunc(): void |
| 13 | 14 | { |
| 14 | 15 | } |