Passed
Pull Request — master (#1104)
by Aleksei
26:20
created
src/Console/src/Bootloader/ConsoleBootloader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function __construct(
43 43
         private readonly ConfiguratorInterface $config
44
-    ) {
44
+    ){
45 45
     }
46 46
 
47 47
     public function init(AbstractKernel $kernel, BinderInterface $binder): void
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
 
102 102
     public function addConfigureSequence(
103
-        string|array|\Closure $sequence,
103
+        string | array | \Closure $sequence,
104 104
         string $header,
105 105
         string $footer = '',
106 106
         array $options = []
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
     public function addUpdateSequence(
112
-        string|array|\Closure $sequence,
112
+        string | array | \Closure $sequence,
113 113
         string $header,
114 114
         string $footer = '',
115 115
         array $options = []
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 
120 120
     public function addSequence(
121 121
         string $name,
122
-        string|array|\Closure $sequence,
122
+        string | array | \Closure $sequence,
123 123
         string $header,
124 124
         string $footer = '',
125 125
         array $options = []
126 126
     ): void {
127
-        if (!isset($this->config->getConfig(ConsoleConfig::CONFIG)['sequences'][$name])) {
127
+        if (!isset($this->config->getConfig(ConsoleConfig::CONFIG)['sequences'][$name])){
128 128
             $this->config->modify(
129 129
                 ConsoleConfig::CONFIG,
130 130
                 new Append('sequences', $name, [])
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 
134 134
         $this->config->modify(
135 135
             ConsoleConfig::CONFIG,
136
-            $this->sequence('sequences.' . $name, $sequence, $header, $footer, $options)
136
+            $this->sequence('sequences.'.$name, $sequence, $header, $footer, $options)
137 137
         );
138 138
     }
139 139
 
140 140
     private function sequence(
141 141
         string $target,
142
-        string|array|callable $sequence,
142
+        string | array | callable $sequence,
143 143
         string $header,
144 144
         string $footer,
145 145
         array $options
Please login to merge, or discard this patch.
src/Console/src/Console.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         #[Proxy] private readonly ContainerInterface $container = new Container(),
39 39
         private readonly ScopeInterface $scope = new Container(),
40 40
         private readonly ?EventDispatcherInterface $dispatcher = null,
41
-    ) {
41
+    ){
42 42
     }
43 43
 
44 44
     /**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function run(
65 65
         ?string $command,
66
-        array|InputInterface $input = [],
66
+        array | InputInterface $input = [],
67 67
         OutputInterface $output = new BufferedOutput(),
68 68
     ): CommandOutput {
69 69
         $input = \is_array($input) ? new ArrayInput($input) : $input;
70 70
 
71 71
         $this->configureIO($input, $output);
72 72
 
73
-        if ($command !== null) {
73
+        if ($command !== null){
74 74
             $input = new InputProxy($input, ['firstArgument' => $command]);
75 75
         }
76 76
 
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function getApplication(): Application
99 99
     {
100
-        if ($this->application !== null) {
100
+        if ($this->application !== null){
101 101
             return $this->application;
102 102
         }
103 103
 
104 104
         $this->application = new Application($this->config->getName(), $this->config->getVersion());
105 105
         $this->application->setCatchExceptions(false);
106 106
         $this->application->setAutoExit(false);
107
-        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) {
107
+        if ($this->dispatcher instanceof SymfonyEventDispatcherInterface){
108 108
             $this->application->setDispatcher($this->dispatcher);
109 109
         }
110 110
 
111
-        if ($this->locator !== null) {
111
+        if ($this->locator !== null){
112 112
             $this->addCommands($this->locator->locateCommands());
113 113
         }
114 114
 
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $interceptors = $this->config->getInterceptors();
130 130
 
131
-        foreach ($commands as $command) {
132
-            if ($command instanceof Command) {
131
+        foreach ($commands as $command){
132
+            if ($command instanceof Command){
133 133
                 $command->setContainer($this->container);
134 134
                 $command->setInterceptors($interceptors);
135 135
             }
136 136
 
137
-            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) {
137
+            if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){
138 138
                 $command->setEventDispatcher($this->dispatcher);
139 139
             }
140 140
 
@@ -149,22 +149,22 @@  discard block
 block discarded – undo
149 149
      */
150 150
     private function configureIO(InputInterface $input, OutputInterface $output): void
151 151
     {
152
-        if ($input->hasParameterOption(['--ansi'], true)) {
152
+        if ($input->hasParameterOption(['--ansi'], true)){
153 153
             $output->setDecorated(true);
154
-        } elseif ($input->hasParameterOption(['--no-ansi'], true)) {
154
+        } elseif ($input->hasParameterOption(['--no-ansi'], true)){
155 155
             $output->setDecorated(false);
156 156
         }
157 157
 
158
-        if ($input->hasParameterOption(['--no-interaction', '-n'], true)) {
158
+        if ($input->hasParameterOption(['--no-interaction', '-n'], true)){
159 159
             $input->setInteractive(false);
160
-        } elseif (\function_exists('posix_isatty')) {
160
+        } elseif (\function_exists('posix_isatty')){
161 161
             $inputStream = null;
162 162
 
163
-            if ($input instanceof StreamableInputInterface) {
163
+            if ($input instanceof StreamableInputInterface){
164 164
                 $inputStream = $input->getStream();
165 165
             }
166 166
 
167
-            if ($inputStream !== null && !@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
167
+            if ($inputStream !== null && !@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')){
168 168
                 $input->setInteractive(false);
169 169
             }
170 170
         }
@@ -177,22 +177,22 @@  discard block
 block discarded – undo
177 177
             default => $shellVerbosity = 0
178 178
         };
179 179
 
180
-        if ($input->hasParameterOption(['--quiet', '-q'], true)) {
180
+        if ($input->hasParameterOption(['--quiet', '-q'], true)){
181 181
             $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
182 182
             $shellVerbosity = -1;
183
-        } else {
183
+        }else{
184 184
             if (
185 185
                 $input->hasParameterOption('-vvv', true)
186 186
                 || $input->hasParameterOption('--verbose=3', true)
187 187
                 || 3 === $input->getParameterOption('--verbose', false, true)
188
-            ) {
188
+            ){
189 189
                 $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
190 190
                 $shellVerbosity = 3;
191 191
             } elseif (
192 192
                 $input->hasParameterOption('-vv', true)
193 193
                 || $input->hasParameterOption('--verbose=2', true)
194 194
                 || 2 === $input->getParameterOption('--verbose', false, true)
195
-            ) {
195
+            ){
196 196
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
197 197
                 $shellVerbosity = 2;
198 198
             } elseif (
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
                 || $input->hasParameterOption('--verbose=1', true)
201 201
                 || $input->hasParameterOption('--verbose', true)
202 202
                 || $input->getParameterOption('--verbose', false, true)
203
-            ) {
203
+            ){
204 204
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
205 205
                 $shellVerbosity = 1;
206 206
             }
207 207
         }
208 208
 
209
-        if (-1 === $shellVerbosity) {
209
+        if (-1 === $shellVerbosity){
210 210
             $input->setInteractive(false);
211 211
         }
212 212
 
213
-        \putenv('SHELL_VERBOSITY=' . $shellVerbosity);
213
+        \putenv('SHELL_VERBOSITY='.$shellVerbosity);
214 214
         $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
215 215
         $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
216 216
     }
Please login to merge, or discard this patch.
src/Hmvc/tests/Interceptors/Unit/Context/TargetTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $target = Target::fromReflectionMethod($reflection, __CLASS__);
48 48
 
49 49
         self::assertSame($reflection, $target->getReflection());
50
-        self::assertSame(__CLASS__ . '->' . __FUNCTION__, (string)$target);
50
+        self::assertSame(__CLASS__.'->'.__FUNCTION__, (string)$target);
51 51
         self::assertNull($target->getObject());
52 52
     }
53 53
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $target = Target::fromReflectionMethod($reflection, $this);
59 59
 
60 60
         self::assertSame($reflection, $target->getReflection());
61
-        self::assertSame(__CLASS__ . '->' . __FUNCTION__, (string)$target);
61
+        self::assertSame(__CLASS__.'->'.__FUNCTION__, (string)$target);
62 62
         self::assertNotNull($target->getObject());
63 63
     }
64 64
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $reflection = $target->getReflection();
125 125
         self::assertSame($hasReflection, $reflection !== null);
126 126
         self::assertNull($target->getObject());
127
-        if ($hasReflection) {
127
+        if ($hasReflection){
128 128
             self::assertInstanceOf(\ReflectionMethod::class, $reflection);
129 129
             self::assertSame($action, $reflection->getName());
130 130
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,8 @@
 block discarded – undo
124 124
         $reflection = $target->getReflection();
125 125
         self::assertSame($hasReflection, $reflection !== null);
126 126
         self::assertNull($target->getObject());
127
-        if ($hasReflection) {
127
+        if ($hasReflection)
128
+        {
128 129
             self::assertInstanceOf(\ReflectionMethod::class, $reflection);
129 130
             self::assertSame($action, $reflection->getName());
130 131
         }
Please login to merge, or discard this patch.
src/Hmvc/src/Interceptors/Context/Target.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         private ?\ReflectionFunctionAbstract $reflection = null,
21 21
         private readonly ?object $object = null,
22 22
         private string $delimiter = '.',
23
-    ) {
23
+    ){
24 24
     }
25 25
 
26 26
     public function __toString(): string
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public static function fromReflectionMethod(
46 46
         \ReflectionFunctionAbstract $reflection,
47
-        string|object $classOrObject,
47
+        string | object $classOrObject,
48 48
     ): self {
49 49
         /** @var self<T> $result */
50 50
         $result = \is_object($classOrObject)
51 51
             ? new self(
52
-                path: [$classOrObject::class, $reflection->getName()],
53
-                reflection: $reflection,
54
-                object: $classOrObject,
55
-                delimiter: $reflection->isStatic() ? '::' : '->',
52
+                path : [$classOrObject::class, $reflection->getName()],
53
+                reflection : $reflection,
54
+                object : $classOrObject,
55
+                delimiter : $reflection->isStatic() ? '::' : '->',
56 56
             )
57 57
             : new self(
58
-                path: [$classOrObject, $reflection->getName()],
59
-                reflection: $reflection,
60
-                delimiter: $reflection->isStatic() ? '::' : '->',
58
+                path : [$classOrObject, $reflection->getName()],
59
+                reflection : $reflection,
60
+                delimiter : $reflection->isStatic() ? '::' : '->',
61 61
             );
62 62
         return $result;
63 63
     }
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @return ($controller is class-string|T ? self<T> : self<null>)
126 126
      */
127
-    public static function fromPair(string|object $controller, string $action): self
127
+    public static function fromPair(string | object $controller, string $action): self
128 128
     {
129 129
         /** @psalm-suppress ArgumentTypeCoercion */
130
-        if (\is_object($controller) || \method_exists($controller, $action)) {
130
+        if (\is_object($controller) || \method_exists($controller, $action)){
131 131
             /** @var T|class-string<T> $controller */
132 132
             return self::fromReflectionMethod(new \ReflectionMethod($controller, $action), $controller);
133 133
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,8 @@
 block discarded – undo
127 127
     public static function fromPair(string|object $controller, string $action): self
128 128
     {
129 129
         /** @psalm-suppress ArgumentTypeCoercion */
130
-        if (\is_object($controller) || \method_exists($controller, $action)) {
130
+        if (\is_object($controller) || \method_exists($controller, $action))
131
+        {
131 132
             /** @var T|class-string<T> $controller */
132 133
             return self::fromReflectionMethod(new \ReflectionMethod($controller, $action), $controller);
133 134
         }
Please login to merge, or discard this patch.
src/Hmvc/src/Core/AbstractCore.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function __construct(
30 30
         /** @internal */
31 31
         #[Proxy] protected ContainerInterface $container
32
-    ) {
32
+    ){
33 33
         // TODO: can we simplify this?
34 34
         // resolver is usually the container itself
35 35
         /** @psalm-suppress MixedAssignment */
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
67 67
     {
68
-        foreach ($method->getParameters() as $parameter) {
68
+        foreach ($method->getParameters() as $parameter){
69 69
             $name = $parameter->getName();
70 70
             if (
71 71
                 \array_key_exists($name, $parameters) &&
72 72
                 $parameters[$name] === null &&
73 73
                 $parameter->isDefaultValueAvailable()
74
-            ) {
74
+            ){
75 75
                 /** @psalm-suppress MixedAssignment */
76 76
                 $parameters[$name] = $parameter->getDefaultValue();
77 77
             }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function invoke(?object $object, string $class, \ReflectionMethod $method, array $arguments): mixed
88 88
     {
89
-        try {
89
+        try{
90 90
             $args = $this->resolveArguments($method, $arguments);
91
-        } catch (ArgumentResolvingException | InvalidArgumentException $e) {
91
+        }catch (ArgumentResolvingException | InvalidArgumentException $e){
92 92
             throw new ControllerException(
93 93
                 \sprintf(
94 94
                     'Missing/invalid parameter %s of `%s`->`%s`',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 ControllerException::BAD_ARGUMENT,
100 100
                 $e,
101 101
             );
102
-        } catch (ContainerExceptionInterface $e) {
102
+        }catch (ContainerExceptionInterface $e){
103 103
             throw new ControllerException(
104 104
                 $e->getMessage(),
105 105
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
67 67
     {
68
-        foreach ($method->getParameters() as $parameter) {
68
+        foreach ($method->getParameters() as $parameter)
69
+        {
69 70
             $name = $parameter->getName();
70 71
             if (
71 72
                 \array_key_exists($name, $parameters) &&
@@ -86,9 +87,12 @@  discard block
 block discarded – undo
86 87
      */
87 88
     private function invoke(?object $object, string $class, \ReflectionMethod $method, array $arguments): mixed
88 89
     {
89
-        try {
90
+        try
91
+        {
90 92
             $args = $this->resolveArguments($method, $arguments);
91
-        } catch (ArgumentResolvingException | InvalidArgumentException $e) {
93
+        }
94
+        catch (ArgumentResolvingException | InvalidArgumentException $e)
95
+        {
92 96
             throw new ControllerException(
93 97
                 \sprintf(
94 98
                     'Missing/invalid parameter %s of `%s`->`%s`',
@@ -99,7 +103,9 @@  discard block
 block discarded – undo
99 103
                 ControllerException::BAD_ARGUMENT,
100 104
                 $e,
101 105
             );
102
-        } catch (ContainerExceptionInterface $e) {
106
+        }
107
+        catch (ContainerExceptionInterface $e)
108
+        {
103 109
             throw new ControllerException(
104 110
                 $e->getMessage(),
105 111
                 ControllerException::ERROR,
Please login to merge, or discard this patch.