Passed
Pull Request — master (#1087)
by Maxim
22:51
created
src/Console/src/Configurator/Signature/Parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $name = $this->parseName($signature);
26 26
 
27
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
28
-            if (\count($matches[1])) {
27
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)){
28
+            if (\count($matches[1])){
29 29
                 return new CommandDefinition($name, ...$this->parseParameters($matches[1]));
30 30
             }
31 31
         }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     private function parseName(string $signature): string
42 42
     {
43
-        if (!\preg_match('/\S+/', $signature, $matches)) {
43
+        if (!\preg_match('/\S+/', $signature, $matches)){
44 44
             throw new InvalidArgumentException('Unable to determine command name from signature.');
45 45
         }
46 46
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
         $arguments = [];
58 58
         $options = [];
59 59
 
60
-        foreach ($tokens as $token) {
61
-            if (\preg_match('/-{2,}(.*)/', $token, $matches)) {
60
+        foreach ($tokens as $token){
61
+            if (\preg_match('/-{2,}(.*)/', $token, $matches)){
62 62
                 $options[] = $this->parseOption($matches[1]);
63
-            } else {
63
+            }else{
64 64
                 $arguments[] = $this->parseArgument($token);
65 65
             }
66 66
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
124 124
         $shortcut = null;
125 125
 
126
-        if (isset($matches[1])) {
126
+        if (isset($matches[1])){
127 127
             [$shortcut, $token] = $matches;
128 128
         }
129 129
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,10 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $name = $this->parseName($signature);
26 26
 
27
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
28
-            if (\count($matches[1])) {
27
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches))
28
+        {
29
+            if (\count($matches[1]))
30
+            {
29 31
                 return new CommandDefinition($name, ...$this->parseParameters($matches[1]));
30 32
             }
31 33
         }
@@ -40,7 +42,8 @@  discard block
 block discarded – undo
40 42
      */
41 43
     private function parseName(string $signature): string
42 44
     {
43
-        if (!\preg_match('/\S+/', $signature, $matches)) {
45
+        if (!\preg_match('/\S+/', $signature, $matches))
46
+        {
44 47
             throw new InvalidArgumentException('Unable to determine command name from signature.');
45 48
         }
46 49
 
@@ -57,10 +60,14 @@  discard block
 block discarded – undo
57 60
         $arguments = [];
58 61
         $options = [];
59 62
 
60
-        foreach ($tokens as $token) {
61
-            if (\preg_match('/-{2,}(.*)/', $token, $matches)) {
63
+        foreach ($tokens as $token)
64
+        {
65
+            if (\preg_match('/-{2,}(.*)/', $token, $matches))
66
+            {
62 67
                 $options[] = $this->parseOption($matches[1]);
63
-            } else {
68
+            }
69
+            else
70
+            {
64 71
                 $arguments[] = $this->parseArgument($token);
65 72
             }
66 73
         }
@@ -123,7 +130,8 @@  discard block
 block discarded – undo
123 130
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
124 131
         $shortcut = null;
125 132
 
126
-        if (isset($matches[1])) {
133
+        if (isset($matches[1]))
134
+        {
127 135
             [$shortcut, $token] = $matches;
128 136
         }
129 137
 
Please login to merge, or discard this patch.
src/Console/src/Configurator/ConstantBasedConfigurator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
     public function configure(Command $command, \ReflectionClass $reflection): void
15 15
     {
16 16
         $command->setName($reflection->getConstant('NAME'));
17
-        $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
17
+        $command->setDescription((string)$reflection->getConstant('DESCRIPTION'));
18 18
 
19
-        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option) {
19
+        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option){
20 20
             \call_user_func_array([$command, 'addOption'], $option);
21 21
         }
22 22
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
23
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument){
24 24
             \call_user_func_array([$command, 'addArgument'], $argument);
25 25
         }
26 26
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@
 block discarded – undo
16 16
         $command->setName($reflection->getConstant('NAME'));
17 17
         $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
18 18
 
19
-        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option) {
19
+        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option)
20
+        {
20 21
             \call_user_func_array([$command, 'addOption'], $option);
21 22
         }
22 23
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
24
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument)
25
+        {
24 26
             \call_user_func_array([$command, 'addArgument'], $argument);
25 27
         }
26 28
     }
Please login to merge, or discard this patch.
src/Tokenizer/tests/Listener/ListenerInvokerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Tokenizer/src/Attribute/TargetClass.php 2 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Console/src/CommandLocatorListener.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Tokenizer/tests/Listener/ClassLocatorByTargetTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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())
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,11 +110,14 @@
 block discarded – undo
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())
Please login to merge, or discard this patch.
src/Tokenizer/tests/Attribute/TargetClassTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Tokenizer/src/Listener/ClassLocatorByTarget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Tokenizer/src/Attribute/AbstractTarget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.