@@ -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 | } |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | private readonly ConsoleBootloader $bootloader, |
27 | 27 | ContainerInterface $container |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | $this->container = $container; |
30 | 30 | $this->target = new \ReflectionClass(SymfonyCommand::class); |
31 | 31 | } |
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 | return; |
37 | 37 | } |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | public function finalize(): void |
43 | 43 | { |
44 | - foreach ($this->commands as $class) { |
|
45 | - if ($class->isAbstract()) { |
|
44 | + foreach ($this->commands as $class){ |
|
45 | + if ($class->isAbstract()){ |
|
46 | 46 | continue; |
47 | 47 | } |
48 | 48 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
57 | 57 | { |
58 | - if (!$target->isTrait()) { |
|
58 | + if (!$target->isTrait()){ |
|
59 | 59 | // Target is interface or class |
60 | 60 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
61 | 61 | } |
@@ -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 | } |
@@ -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()) |
@@ -12,9 +12,9 @@ |
||
12 | 12 | public function testToString(): void |
13 | 13 | { |
14 | 14 | $attribute = new TargetClass('foo'); |
15 | - $this->assertSame('3319d33aad20ad375d27dcd03c879454', (string) $attribute); |
|
15 | + $this->assertSame('3319d33aad20ad375d27dcd03c879454', (string)$attribute); |
|
16 | 16 | |
17 | 17 | $attribute = new TargetClass('foo', 'bar'); |
18 | - $this->assertSame('a95c8a2cfc901290939df93183ce98d6', (string) $attribute); |
|
18 | + $this->assertSame('a95c8a2cfc901290939df93183ce98d6', (string)$attribute); |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function __construct( |
20 | 20 | private readonly ClassesInterface $classes, |
21 | 21 | private readonly ScopedClassesInterface $scopedClasses, |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function __construct( |
13 | 13 | public readonly ?string $scope = null, |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __toString(): string |
22 | 22 | { |
23 | - return \md5(\print_r($this, return: true)); |
|
23 | + return \md5(\print_r($this, return : true)); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | protected const NAME = 'create:command-without-namespace'; |
14 | 14 | |
15 | - protected const ARGUMENTS = [ |
|
15 | + protected const ARGUMENTS = [ |
|
16 | 16 | ['name', InputArgument::REQUIRED, 'Command name'], |
17 | 17 | ['alias', InputArgument::OPTIONAL, 'Command id/alias'], |
18 | 18 | ]; |
@@ -13,12 +13,12 @@ |
||
13 | 13 | { |
14 | 14 | protected const NAME = 'create:command-with-namespace'; |
15 | 15 | |
16 | - protected const ARGUMENTS = [ |
|
16 | + protected const ARGUMENTS = [ |
|
17 | 17 | ['name', InputArgument::REQUIRED, 'Command name'], |
18 | 18 | ['alias', InputArgument::OPTIONAL, 'Command id/alias'], |
19 | 19 | ]; |
20 | 20 | |
21 | - protected const OPTIONS = [ |
|
21 | + protected const OPTIONS = [ |
|
22 | 22 | [ |
23 | 23 | 'namespace', |
24 | 24 | null, |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | public function __construct( |
16 | 16 | private readonly Parser $parser |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function canConfigure(Command $command, \ReflectionClass $reflection): bool |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | $result = $this->parser->parse($reflection); |
28 | 28 | |
29 | 29 | $command->setName($result->name); |
30 | - $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
|
31 | - $command->setHelp((string) $result->help); |
|
30 | + $command->setDescription($result->description ?? (string)$reflection->getConstant('DESCRIPTION')); |
|
31 | + $command->setHelp((string)$result->help); |
|
32 | 32 | |
33 | - foreach ($result->options as $option) { |
|
33 | + foreach ($result->options as $option){ |
|
34 | 34 | $command->getDefinition()->addOption($option); |
35 | 35 | } |
36 | 36 | |
37 | - foreach ($result->arguments as $argument) { |
|
37 | + foreach ($result->arguments as $argument){ |
|
38 | 38 | $command->getDefinition()->addArgument($argument); |
39 | 39 | } |
40 | 40 | } |
@@ -30,11 +30,13 @@ |
||
30 | 30 | $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
31 | 31 | $command->setHelp((string) $result->help); |
32 | 32 | |
33 | - foreach ($result->options as $option) { |
|
33 | + foreach ($result->options as $option) |
|
34 | + { |
|
34 | 35 | $command->getDefinition()->addOption($option); |
35 | 36 | } |
36 | 37 | |
37 | - foreach ($result->arguments as $argument) { |
|
38 | + foreach ($result->arguments as $argument) |
|
39 | + { |
|
38 | 40 | $command->getDefinition()->addArgument($argument); |
39 | 41 | } |
40 | 42 | } |