Test Failed
Pull Request — master (#1190)
by butschster
10:27
created
src/Hmvc/src/AbstractCore.php 2 patches
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.
Spacing   +7 added lines, -7 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 */
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             ? $container
38 38
             : $container
39 39
                 ->get(InvokerInterface::class)
40
-                ->invoke(static fn (#[Proxy] ResolverInterface $resolver): ResolverInterface => $resolver);
40
+                ->invoke(static fn (#[Proxy] ResolverInterface $resolver) : ResolverInterface => $resolver);
41 41
     }
42 42
 
43 43
     /**
@@ -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.
src/Interceptors/tests/Unit/Handler/AutowireHandlerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
     public function createHandler(array $definitions = []): AutowireHandler
109 109
     {
110 110
         $container = new Container();
111
-        foreach ($definitions as $id => $definition) {
111
+        foreach ($definitions as $id => $definition){
112 112
             $container->bind($id, $definition);
113 113
         }
114 114
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@
 block discarded – undo
108 108
     public function createHandler(array $definitions = []): AutowireHandler
109 109
     {
110 110
         $container = new Container();
111
-        foreach ($definitions as $id => $definition) {
111
+        foreach ($definitions as $id => $definition)
112
+        {
112 113
             $container->bind($id, $definition);
113 114
         }
114 115
 
Please login to merge, or discard this patch.
src/Interceptors/src/PipelineBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
     public function __construct(
18 18
         ?EventDispatcherInterface $dispatcher = null
19
-    ) {
19
+    ){
20 20
         $this->pipeline = new InterceptorPipeline($dispatcher);
21 21
     }
22 22
 
Please login to merge, or discard this patch.
src/Interceptors/src/Handler/AutowireHandler.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function __construct(
22 22
         /** @internal */
23 23
         protected ContainerInterface $container,
24
-    ) {
24
+    ){
25 25
     }
26 26
 
27 27
     /**
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
         );
39 39
         $path = $context->getTarget()->getPath();
40 40
 
41
-        if ($method instanceof \ReflectionFunction) {
41
+        if ($method instanceof \ReflectionFunction){
42 42
             return $method->invokeArgs(
43 43
                 $this->resolveArguments($method, $context)
44 44
             );
45 45
         }
46 46
 
47
-        if (!$method instanceof \ReflectionMethod) {
47
+        if (!$method instanceof \ReflectionMethod){
48 48
             throw new TargetCallException("Action not found for target `{$context->getTarget()}`.");
49 49
         }
50 50
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,13 +38,15 @@
 block discarded – undo
38 38
         );
39 39
         $path = $context->getTarget()->getPath();
40 40
 
41
-        if ($method instanceof \ReflectionFunction) {
41
+        if ($method instanceof \ReflectionFunction)
42
+        {
42 43
             return $method->invokeArgs(
43 44
                 $this->resolveArguments($method, $context)
44 45
             );
45 46
         }
46 47
 
47
-        if (!$method instanceof \ReflectionMethod) {
48
+        if (!$method instanceof \ReflectionMethod)
49
+        {
48 50
             throw new TargetCallException("Action not found for target `{$context->getTarget()}`.");
49 51
         }
50 52
 
Please login to merge, or discard this patch.
src/Views/src/ViewManager.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
         private readonly GlobalVariablesInterface $globalVariables,
23 23
         FactoryInterface $factory,
24 24
         ?ContextInterface $context = null
25
-    ) {
25
+    ){
26 26
         $this->context = $context ?? new ViewContext();
27 27
         $this->loader = $factory->make(LoaderInterface::class, [
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency){
32 32
             $this->addDependency($dependency->resolve($factory));
33 33
         }
34 34
 
35
-        foreach ($this->config->getEngines() as $engine) {
35
+        foreach ($this->config->getEngines() as $engine){
36 36
             $this->addEngine($engine->resolve($factory));
37 37
         }
38 38
 
39
-        if ($this->config->isCacheEnabled()) {
39
+        if ($this->config->isCacheEnabled()){
40 40
             $this->cache = new ViewCache();
41 41
         }
42 42
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         // Rotate all possible context variants and warm up cache
95 95
         $generator = new ContextGenerator($this->context);
96
-        foreach ($generator->generate() as $context) {
96
+        foreach ($generator->generate() as $context){
97 97
             $engine->reset($path, $context);
98 98
             $engine->compile($path, $context);
99 99
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         // Rotate all possible context variants and warm up cache
112 112
         $generator = new ContextGenerator($this->context);
113
-        foreach ($generator->generate() as $context) {
113
+        foreach ($generator->generate() as $context){
114 114
             $engine->reset($path, $context);
115 115
         }
116 116
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function get(string $path): ViewInterface
124 124
     {
125
-        if ($this->cache?->has($this->context, $path)) {
125
+        if ($this->cache?->has($this->context, $path)){
126 126
             return $this->cache->get($this->context, $path);
127 127
         }
128 128
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function findEngine(string $path): EngineInterface
152 152
     {
153
-        foreach ($this->engines as $engine) {
154
-            if ($engine->getLoader()->exists($path)) {
153
+        foreach ($this->engines as $engine){
154
+            if ($engine->getLoader()->exists($path)){
155 155
                 return $engine;
156 156
             }
157 157
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,15 +28,18 @@  discard block
 block discarded – undo
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency)
32
+        {
32 33
             $this->addDependency($dependency->resolve($factory));
33 34
         }
34 35
 
35
-        foreach ($this->config->getEngines() as $engine) {
36
+        foreach ($this->config->getEngines() as $engine)
37
+        {
36 38
             $this->addEngine($engine->resolve($factory));
37 39
         }
38 40
 
39
-        if ($this->config->isCacheEnabled()) {
41
+        if ($this->config->isCacheEnabled())
42
+        {
40 43
             $this->cache = new ViewCache();
41 44
         }
42 45
     }
@@ -93,7 +96,8 @@  discard block
 block discarded – undo
93 96
 
94 97
         // Rotate all possible context variants and warm up cache
95 98
         $generator = new ContextGenerator($this->context);
96
-        foreach ($generator->generate() as $context) {
99
+        foreach ($generator->generate() as $context)
100
+        {
97 101
             $engine->reset($path, $context);
98 102
             $engine->compile($path, $context);
99 103
         }
@@ -110,7 +114,8 @@  discard block
 block discarded – undo
110 114
 
111 115
         // Rotate all possible context variants and warm up cache
112 116
         $generator = new ContextGenerator($this->context);
113
-        foreach ($generator->generate() as $context) {
117
+        foreach ($generator->generate() as $context)
118
+        {
114 119
             $engine->reset($path, $context);
115 120
         }
116 121
     }
@@ -122,7 +127,8 @@  discard block
 block discarded – undo
122 127
      */
123 128
     public function get(string $path): ViewInterface
124 129
     {
125
-        if ($this->cache?->has($this->context, $path)) {
130
+        if ($this->cache?->has($this->context, $path))
131
+        {
126 132
             return $this->cache->get($this->context, $path);
127 133
         }
128 134
 
@@ -150,8 +156,10 @@  discard block
 block discarded – undo
150 156
      */
151 157
     private function findEngine(string $path): EngineInterface
152 158
     {
153
-        foreach ($this->engines as $engine) {
154
-            if ($engine->getLoader()->exists($path)) {
159
+        foreach ($this->engines as $engine)
160
+        {
161
+            if ($engine->getLoader()->exists($path))
162
+            {
155 163
                 return $engine;
156 164
             }
157 165
         }
Please login to merge, or discard this patch.
src/Broadcasting/src/Bootloader/WebsocketsBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             ResponseFactoryInterface $responseFactory,
30 30
             BroadcastConfig $config,
31 31
             ?EventDispatcherInterface $dispatcher = null,
32
-        ): AuthorizationMiddleware => new AuthorizationMiddleware(
32
+        ) : AuthorizationMiddleware => new AuthorizationMiddleware(
33 33
             $broadcast,
34 34
             $responseFactory,
35 35
             $config->getAuthorizationPath(),
Please login to merge, or discard this patch.
src/Translator/src/Translator.php 2 patches
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setLocale(string $locale): void
44 44
     {
45
-        if (!$this->catalogueManager->has($locale)) {
45
+        if (!$this->catalogueManager->has($locale))
46
+        {
46 47
             throw new LocaleException($locale);
47 48
         }
48 49
 
@@ -94,7 +95,8 @@  discard block
 block discarded – undo
94 95
         $domain ??= $this->config->getDefaultDomain();
95 96
         $locale ??= $this->locale;
96 97
 
97
-        try {
98
+        try
99
+        {
98 100
             $message = $this->get($locale, $domain, $id);
99 101
 
100 102
             $pluralized = $this->identityTranslator->trans(
@@ -103,12 +105,15 @@  discard block
 block discarded – undo
103 105
                 null,
104 106
                 $locale
105 107
             );
106
-        } catch (\InvalidArgumentException $e) {
108
+        }
109
+        catch (\InvalidArgumentException $e)
110
+        {
107 111
             //Wrapping into more explanatory exception
108 112
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
109 113
         }
110 114
 
111
-        if (empty($parameters['n']) && is_numeric($number)) {
115
+        if (empty($parameters['n']) && is_numeric($number))
116
+        {
112 117
             $parameters['n'] = $number;
113 118
         }
114 119
 
@@ -132,13 +137,18 @@  discard block
 block discarded – undo
132 137
         string $postfix = '}'
133 138
     ): string {
134 139
         $replaces = [];
135
-        foreach ($values as $key => $value) {
140
+        foreach ($values as $key => $value)
141
+        {
136 142
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
137 143
 
138
-            if (\is_object($value)) {
139
-                if (\method_exists($value, '__toString')) {
144
+            if (\is_object($value))
145
+            {
146
+                if (\method_exists($value, '__toString'))
147
+                {
140 148
                     $value = $value->__toString();
141
-                } else {
149
+                }
150
+                else
151
+                {
142 152
                     $value = '';
143 153
                 }
144 154
             }
@@ -163,18 +173,21 @@  discard block
 block discarded – undo
163 173
      */
164 174
     protected function get(string &$locale, string $domain, string $string): string
165 175
     {
166
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
176
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
177
+        {
167 178
             return $this->catalogueManager->get($locale)->get($domain, $string);
168 179
         }
169 180
 
170 181
         $locale = $this->config->getFallbackLocale();
171 182
 
172
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
183
+        if ($this->catalogueManager->get($locale)->has($domain, $string))
184
+        {
173 185
             return $this->catalogueManager->get($locale)->get($domain, $string);
174 186
         }
175 187
 
176 188
         // we can automatically register message
177
-        if ($this->config->isAutoRegisterMessages()) {
189
+        if ($this->config->isAutoRegisterMessages())
190
+        {
178 191
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
179 192
             $this->catalogueManager->save($locale);
180 193
         }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         /** @internal */
28 28
         private readonly IdentityTranslator $identityTranslator = new IdentityTranslator(),
29 29
         private readonly ?EventDispatcherInterface $dispatcher = null,
30
-    ) {
30
+    ){
31 31
         $this->locale = $this->config->getDefaultLocale();
32 32
         $this->catalogueManager->load($this->locale);
33 33
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setLocale(string $locale): void
44 44
     {
45
-        if (!$this->catalogueManager->has($locale)) {
45
+        if (!$this->catalogueManager->has($locale)){
46 46
             throw new LocaleException($locale);
47 47
         }
48 48
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function transChoice(
88 88
         string $id,
89
-        string|int $number,
89
+        string | int $number,
90 90
         array $parameters = [],
91 91
         ?string $domain = null,
92 92
         ?string $locale = null
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $domain ??= $this->config->getDefaultDomain();
95 95
         $locale ??= $this->locale;
96 96
 
97
-        try {
97
+        try{
98 98
             $message = $this->get($locale, $domain, $id);
99 99
 
100 100
             $pluralized = $this->identityTranslator->trans(
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
                 null,
104 104
                 $locale
105 105
             );
106
-        } catch (\InvalidArgumentException $e) {
106
+        }catch (\InvalidArgumentException $e){
107 107
             //Wrapping into more explanatory exception
108 108
             throw new PluralizationException($e->getMessage(), $e->getCode(), $e);
109 109
         }
110 110
 
111
-        if (empty($parameters['n']) && is_numeric($number)) {
111
+        if (empty($parameters['n']) && is_numeric($number)){
112 112
             $parameters['n'] = $number;
113 113
         }
114 114
 
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
         string $postfix = '}'
133 133
     ): string {
134 134
         $replaces = [];
135
-        foreach ($values as $key => $value) {
135
+        foreach ($values as $key => $value){
136 136
             $value = (\is_array($value) || $value instanceof \Closure) ? '' : $value;
137 137
 
138
-            if (\is_object($value)) {
139
-                if (\method_exists($value, '__toString')) {
138
+            if (\is_object($value)){
139
+                if (\method_exists($value, '__toString')){
140 140
                     $value = $value->__toString();
141
-                } else {
141
+                }else{
142 142
                     $value = '';
143 143
                 }
144 144
             }
145 145
 
146
-            $replaces[$prefix . $key . $postfix] = $value;
146
+            $replaces[$prefix.$key.$postfix] = $value;
147 147
         }
148 148
 
149 149
         return \strtr($string, $replaces);
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function get(string &$locale, string $domain, string $string): string
165 165
     {
166
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
166
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
167 167
             return $this->catalogueManager->get($locale)->get($domain, $string);
168 168
         }
169 169
 
170 170
         $locale = $this->config->getFallbackLocale();
171 171
 
172
-        if ($this->catalogueManager->get($locale)->has($domain, $string)) {
172
+        if ($this->catalogueManager->get($locale)->has($domain, $string)){
173 173
             return $this->catalogueManager->get($locale)->get($domain, $string);
174 174
         }
175 175
 
176 176
         // we can automatically register message
177
-        if ($this->config->isAutoRegisterMessages()) {
177
+        if ($this->config->isAutoRegisterMessages()){
178 178
             $this->catalogueManager->get($locale)->set($domain, $string, $string);
179 179
             $this->catalogueManager->save($locale);
180 180
         }
Please login to merge, or discard this patch.
src/Boot/tests/EnvironmentTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
     /**
87 87
      * @throws \Throwable
88 88
      */
89
-    protected function getEnv(array $env, bool $overwite= true): EnvironmentInterface
89
+    protected function getEnv(array $env, bool $overwite = true): EnvironmentInterface
90 90
     {
91 91
         $core = TestCore::create(['root' => __DIR__])->run(new Environment($env, $overwite));
92 92
 
Please login to merge, or discard this patch.
src/Scaffolder/tests/Command/AbstractCommandTestCase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
     protected function deleteDeclaration(string $class): void
18 18
     {
19
-        if (class_exists($class)) {
20
-            try {
19
+        if (class_exists($class)){
20
+            try{
21 21
                 $reflection = new ReflectionClass($class);
22 22
                 $this->files()->delete($reflection->getFileName());
23
-            } catch (Throwable $exception) {
23
+            }catch (Throwable $exception){
24 24
                 var_dump($exception->getMessage());
25 25
             }
26 26
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         parent::tearDown();
48 48
 
49
-        if ($this->className) {
49
+        if ($this->className){
50 50
             $this->deleteDeclaration($this->className);
51 51
         }
52 52
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,15 @@  discard block
 block discarded – undo
16 16
 
17 17
     protected function deleteDeclaration(string $class): void
18 18
     {
19
-        if (class_exists($class)) {
20
-            try {
19
+        if (class_exists($class))
20
+        {
21
+            try
22
+            {
21 23
                 $reflection = new ReflectionClass($class);
22 24
                 $this->files()->delete($reflection->getFileName());
23
-            } catch (Throwable $exception) {
25
+            }
26
+            catch (Throwable $exception)
27
+            {
24 28
                 var_dump($exception->getMessage());
25 29
             }
26 30
         }
@@ -46,7 +50,8 @@  discard block
 block discarded – undo
46 50
     {
47 51
         parent::tearDown();
48 52
 
49
-        if ($this->className) {
53
+        if ($this->className)
54
+        {
50 55
             $this->deleteDeclaration($this->className);
51 56
         }
52 57
     }
Please login to merge, or discard this patch.