Passed
Pull Request — master (#839)
by Alexander
16:59
created
src/Console/src/CommandLocatorListener.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
     public function __construct(
24 24
         private readonly ConsoleBootloader $bootloader,
25 25
         ContainerInterface $container
26
-    ) {
26
+    ){
27 27
         $this->container = $container;
28 28
         $this->target = new \ReflectionClass(SymfonyCommand::class);
29 29
     }
30 30
 
31 31
     public function listen(\ReflectionClass $class): void
32 32
     {
33
-        if (!$this->isTargeted($class, $this->target)) {
33
+        if (!$this->isTargeted($class, $this->target)){
34 34
             return;
35 35
         }
36 36
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function finalize(): void
41 41
     {
42
-        foreach ($this->commands as $class) {
43
-            if ($class->isAbstract()) {
42
+        foreach ($this->commands as $class){
43
+            if ($class->isAbstract()){
44 44
                 continue;
45 45
             }
46 46
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool
55 55
     {
56
-        if (!$target->isTrait()) {
56
+        if (!$target->isTrait()){
57 57
             //Target is interface or class
58 58
             return $class->isSubclassOf($target) || $class->getName() === $target->getName();
59 59
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function listen(\ReflectionClass $class): void
32 32
     {
33
-        if (!$this->isTargeted($class, $this->target)) {
33
+        if (!$this->isTargeted($class, $this->target))
34
+        {
34 35
             return;
35 36
         }
36 37
 
@@ -39,8 +40,10 @@  discard block
 block discarded – undo
39 40
 
40 41
     public function finalize(): void
41 42
     {
42
-        foreach ($this->commands as $class) {
43
-            if ($class->isAbstract()) {
43
+        foreach ($this->commands as $class)
44
+        {
45
+            if ($class->isAbstract())
46
+            {
44 47
                 continue;
45 48
             }
46 49
 
@@ -53,7 +56,8 @@  discard block
 block discarded – undo
53 56
      */
54 57
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool
55 58
     {
56
-        if (!$target->isTrait()) {
59
+        if (!$target->isTrait())
60
+        {
57 61
             //Target is interface or class
58 62
             return $class->isSubclassOf($target) || $class->getName() === $target->getName();
59 63
         }
Please login to merge, or discard this patch.
src/Console/src/CommandCore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 {
14 14
     public function __construct(
15 15
         private readonly InvokerInterface $invoker
16
-    ) {
16
+    ){
17 17
     }
18 18
 
19 19
     /**
Please login to merge, or discard this patch.
src/Console/src/Event/CommandFinished.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
         public readonly int $exitCode,
16 16
         public readonly InputInterface $input,
17 17
         public readonly OutputInterface $output
18
-    ) {
18
+    ){
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/Console/src/Event/CommandStarting.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
         public readonly Command $command,
15 15
         public readonly InputInterface $input,
16 16
         public readonly OutputInterface $output
17
-    ) {
17
+    ){
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Console/src/Command.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function execute(InputInterface $input, OutputInterface $output): int
71 71
     {
72
-        if ($this->container === null) {
72
+        if ($this->container === null){
73 73
             throw new ScopeException('Container is not set');
74 74
         }
75 75
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         $core = $this->buildCore();
79 79
 
80
-        try {
80
+        try{
81 81
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
82 82
 
83 83
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
93 93
 
94 94
             return $code;
95
-        } finally {
95
+        }finally{
96 96
             [$this->input, $this->output] = [null, null];
97 97
         }
98 98
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         $interceptableCore = new InterceptableCore($core, $this->eventDispatcher);
105 105
 
106
-        foreach ($this->interceptors as $interceptor) {
106
+        foreach ($this->interceptors as $interceptor){
107 107
             $interceptableCore->addInterceptor($this->container->get($interceptor));
108 108
         }
109 109
 
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function configure(): void
127 127
     {
128
-        if (static::SIGNATURE !== null) {
128
+        if (static::SIGNATURE !== null){
129 129
             $this->configureViaSignature((string)static::SIGNATURE);
130
-        } else {
130
+        }else{
131 131
             $this->setName(static::NAME);
132 132
         }
133 133
 
134 134
         $this->setDescription((string)static::DESCRIPTION);
135 135
 
136
-        foreach ($this->defineOptions() as $option) {
136
+        foreach ($this->defineOptions() as $option){
137 137
             \call_user_func_array([$this, 'addOption'], $option);
138 138
         }
139 139
 
140
-        foreach ($this->defineArguments() as $argument) {
140
+        foreach ($this->defineArguments() as $argument){
141 141
             \call_user_func_array([$this, 'addArgument'], $argument);
142 142
         }
143 143
     }
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 
149 149
         $this->setName($result->name);
150 150
 
151
-        foreach ($result->options as $option) {
151
+        foreach ($result->options as $option){
152 152
             $this->getDefinition()->addOption($option);
153 153
         }
154 154
 
155
-        foreach ($result->arguments as $argument) {
155
+        foreach ($result->arguments as $argument){
156 156
             $this->getDefinition()->addArgument($argument);
157 157
         }
158 158
     }
Please login to merge, or discard this patch.
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function execute(InputInterface $input, OutputInterface $output): int
71 71
     {
72
-        if ($this->container === null) {
72
+        if ($this->container === null)
73
+        {
73 74
             throw new ScopeException('Container is not set');
74 75
         }
75 76
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
 
78 79
         $core = $this->buildCore();
79 80
 
80
-        try {
81
+        try
82
+        {
81 83
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
82 84
 
83 85
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -92,7 +94,9 @@  discard block
 block discarded – undo
92 94
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
93 95
 
94 96
             return $code;
95
-        } finally {
97
+        }
98
+        finally
99
+        {
96 100
             [$this->input, $this->output] = [null, null];
97 101
         }
98 102
     }
@@ -103,7 +107,8 @@  discard block
 block discarded – undo
103 107
 
104 108
         $interceptableCore = new InterceptableCore($core, $this->eventDispatcher);
105 109
 
106
-        foreach ($this->interceptors as $interceptor) {
110
+        foreach ($this->interceptors as $interceptor)
111
+        {
107 112
             $interceptableCore->addInterceptor($this->container->get($interceptor));
108 113
         }
109 114
 
@@ -125,19 +130,24 @@  discard block
 block discarded – undo
125 130
      */
126 131
     protected function configure(): void
127 132
     {
128
-        if (static::SIGNATURE !== null) {
133
+        if (static::SIGNATURE !== null)
134
+        {
129 135
             $this->configureViaSignature((string)static::SIGNATURE);
130
-        } else {
136
+        }
137
+        else
138
+        {
131 139
             $this->setName(static::NAME);
132 140
         }
133 141
 
134 142
         $this->setDescription((string)static::DESCRIPTION);
135 143
 
136
-        foreach ($this->defineOptions() as $option) {
144
+        foreach ($this->defineOptions() as $option)
145
+        {
137 146
             \call_user_func_array([$this, 'addOption'], $option);
138 147
         }
139 148
 
140
-        foreach ($this->defineArguments() as $argument) {
149
+        foreach ($this->defineArguments() as $argument)
150
+        {
141 151
             \call_user_func_array([$this, 'addArgument'], $argument);
142 152
         }
143 153
     }
@@ -148,11 +158,13 @@  discard block
 block discarded – undo
148 158
 
149 159
         $this->setName($result->name);
150 160
 
151
-        foreach ($result->options as $option) {
161
+        foreach ($result->options as $option)
162
+        {
152 163
             $this->getDefinition()->addOption($option);
153 164
         }
154 165
 
155
-        foreach ($result->arguments as $argument) {
166
+        foreach ($result->arguments as $argument)
167
+        {
156 168
             $this->getDefinition()->addArgument($argument);
157 169
         }
158 170
     }
Please login to merge, or discard this patch.
src/Console/src/StaticLocator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         private readonly array $commands,
23 23
         array $interceptors = [],
24 24
         ContainerInterface $container = new Container()
25
-    ) {
25
+    ){
26 26
         $this->interceptors = $interceptors;
27 27
         $this->container = $container;
28 28
     }
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
     public function locateCommands(): array
34 34
     {
35 35
         $commands = [];
36
-        foreach ($this->commands as $command) {
37
-            if ($command instanceof SymfonyCommand) {
36
+        foreach ($this->commands as $command){
37
+            if ($command instanceof SymfonyCommand){
38 38
                 $commands[] = $command;
39 39
                 continue;
40 40
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,10 @@
 block discarded – undo
33 33
     public function locateCommands(): array
34 34
     {
35 35
         $commands = [];
36
-        foreach ($this->commands as $command) {
37
-            if ($command instanceof SymfonyCommand) {
36
+        foreach ($this->commands as $command)
37
+        {
38
+            if ($command instanceof SymfonyCommand)
39
+            {
38 40
                 $commands[] = $command;
39 41
                 continue;
40 42
             }
Please login to merge, or discard this patch.
src/Console/src/Signature/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
         public readonly array $arguments = [],
17 17
         /** @var InputOption[] */
18 18
         public readonly array $options = [],
19
-    ) {
19
+    ){
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
src/Console/src/Signature/Parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $name = $this->parseName($signature);
25 25
 
26
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
27
-            if (\count($matches[1])) {
26
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)){
27
+            if (\count($matches[1])){
28 28
                 return new Result($name, ...$this->parseParameters($matches[1]));
29 29
             }
30 30
         }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     private function parseName(string $signature): string
41 41
     {
42
-        if (!\preg_match('/\S+/', $signature, $matches)) {
42
+        if (!\preg_match('/\S+/', $signature, $matches)){
43 43
             throw new InvalidArgumentException('Unable to determine command name from signature.');
44 44
         }
45 45
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
         $arguments = [];
57 57
         $options = [];
58 58
 
59
-        foreach ($tokens as $token) {
60
-            if (\preg_match('/-{2,}(.*)/', $token, $matches)) {
59
+        foreach ($tokens as $token){
60
+            if (\preg_match('/-{2,}(.*)/', $token, $matches)){
61 61
                 $options[] = $this->parseOption($matches[1]);
62
-            } else {
62
+            }else{
63 63
                 $arguments[] = $this->parseArgument($token);
64 64
             }
65 65
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
123 123
         $shortcut = null;
124 124
 
125
-        if (isset($matches[1])) {
125
+        if (isset($matches[1])){
126 126
             [$shortcut, $token] = $matches;
127 127
         }
128 128
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,8 +23,10 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $name = $this->parseName($signature);
25 25
 
26
-        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches)) {
27
-            if (\count($matches[1])) {
26
+        if (\preg_match_all('/\{\s*(.*?)\s*\}/', $signature, $matches))
27
+        {
28
+            if (\count($matches[1]))
29
+            {
28 30
                 return new Result($name, ...$this->parseParameters($matches[1]));
29 31
             }
30 32
         }
@@ -39,7 +41,8 @@  discard block
 block discarded – undo
39 41
      */
40 42
     private function parseName(string $signature): string
41 43
     {
42
-        if (!\preg_match('/\S+/', $signature, $matches)) {
44
+        if (!\preg_match('/\S+/', $signature, $matches))
45
+        {
43 46
             throw new InvalidArgumentException('Unable to determine command name from signature.');
44 47
         }
45 48
 
@@ -56,10 +59,14 @@  discard block
 block discarded – undo
56 59
         $arguments = [];
57 60
         $options = [];
58 61
 
59
-        foreach ($tokens as $token) {
60
-            if (\preg_match('/-{2,}(.*)/', $token, $matches)) {
62
+        foreach ($tokens as $token)
63
+        {
64
+            if (\preg_match('/-{2,}(.*)/', $token, $matches))
65
+            {
61 66
                 $options[] = $this->parseOption($matches[1]);
62
-            } else {
67
+            }
68
+            else
69
+            {
63 70
                 $arguments[] = $this->parseArgument($token);
64 71
             }
65 72
         }
@@ -122,7 +129,8 @@  discard block
 block discarded – undo
122 129
         $matches = \preg_split('/\s*\|\s*/', $token, 2);
123 130
         $shortcut = null;
124 131
 
125
-        if (isset($matches[1])) {
132
+        if (isset($matches[1]))
133
+        {
126 134
             [$shortcut, $token] = $matches;
127 135
         }
128 136
 
Please login to merge, or discard this patch.
src/Console/src/InputProxy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __construct(
16 16
         private readonly InputInterface $input,
17 17
         private readonly array $overwrite
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function getFirstArgument(): ?string
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
         return $this->overwrite['firstArgument'] ?? $this->input->getFirstArgument();
24 24
     }
25 25
 
26
-    public function hasParameterOption(string|array $values, bool $onlyParams = false): bool
26
+    public function hasParameterOption(string | array $values, bool $onlyParams = false): bool
27 27
     {
28 28
         return $this->input->hasParameterOption($values, $onlyParams);
29 29
     }
30 30
 
31 31
     public function getParameterOption(
32
-        string|array $values,
33
-        string|bool|int|float|array|null $default = false,
32
+        string | array $values,
33
+        string | bool | int | float | array | null $default = false,
34 34
         bool $onlyParams = false
35 35
     ): mixed {
36 36
         return $this->input->getParameterOption($values, $default, $onlyParams);
Please login to merge, or discard this patch.