Passed
Pull Request — master (#933)
by Maxim
36:02 queued 25:52
created
src/Router/tests/Fixtures/TestController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
         return $id;
30 30
     }
31 31
 
32
-    public function defaultInt(string|int $id = 1): string
32
+    public function defaultInt(string | int $id = 1): string
33 33
     {
34 34
         $result = \is_int($id) ? 'int: ' : 'string: ';
35 35
 
36
-        return $result . $id;
36
+        return $result.$id;
37 37
     }
38 38
 
39 39
     public function echo(): void
Please login to merge, or discard this patch.
src/Hmvc/src/AbstractCore.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
     public function __construct(
25 25
         /** @internal */
26 26
         protected ContainerInterface $container
27
-    ) {
27
+    ){
28 28
         // resolver is usually the container itself
29 29
         $this->resolver = $container->get(ResolverInterface::class);
30 30
     }
31 31
 
32 32
     public function callAction(string $controller, string $action, array $parameters = []): mixed
33 33
     {
34
-        try {
34
+        try{
35 35
             $method = new \ReflectionMethod($controller, $action);
36
-        } catch (\ReflectionException $e) {
36
+        }catch (\ReflectionException $e){
37 37
             throw new ControllerException(
38 38
                 \sprintf('Invalid action `%s`->`%s`', $controller, $action),
39 39
                 ControllerException::BAD_ACTION,
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
             );
42 42
         }
43 43
 
44
-        if ($method->isStatic() || !$method->isPublic()) {
44
+        if ($method->isStatic() || !$method->isPublic()){
45 45
             throw new ControllerException(
46 46
                 \sprintf('Invalid action `%s`->`%s`', $controller, $action),
47 47
                 ControllerException::BAD_ACTION
48 48
             );
49 49
         }
50 50
 
51
-        try {
51
+        try{
52 52
             $args = $this->resolveArguments($method, $parameters);
53
-        } catch (ArgumentResolvingException|InvalidArgumentException $e) {
53
+        }catch (ArgumentResolvingException | InvalidArgumentException $e){
54 54
             throw new ControllerException(
55 55
                 \sprintf('Missing/invalid parameter %s of `%s`->`%s`', $e->getParameter(), $controller, $action),
56 56
                 ControllerException::BAD_ARGUMENT,
57 57
                 $e
58 58
             );
59
-        } catch (ContainerExceptionInterface $e) {
59
+        }catch (ContainerExceptionInterface $e){
60 60
             throw new ControllerException(
61 61
                 $e->getMessage(),
62 62
                 ControllerException::ERROR,
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 
74 74
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
75 75
     {
76
-        foreach ($method->getParameters() as $parameter) {
76
+        foreach ($method->getParameters() as $parameter){
77 77
             $name = $parameter->getName();
78 78
             if (
79 79
                 \array_key_exists($name, $parameters) &&
80 80
                 $parameters[$name] === null &&
81 81
                 $parameter->isDefaultValueAvailable()
82
-            ) {
82
+            ){
83 83
                 $parameters[$name] = $parameter->getDefaultValue();
84 84
             }
85 85
         }
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,9 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function callAction(string $controller, string $action, array $parameters = []): mixed
33 33
     {
34
-        try {
34
+        try
35
+        {
35 36
             $method = new \ReflectionMethod($controller, $action);
36
-        } catch (\ReflectionException $e) {
37
+        }
38
+        catch (\ReflectionException $e)
39
+        {
37 40
             throw new ControllerException(
38 41
                 \sprintf('Invalid action `%s`->`%s`', $controller, $action),
39 42
                 ControllerException::BAD_ACTION,
@@ -41,22 +44,28 @@  discard block
 block discarded – undo
41 44
             );
42 45
         }
43 46
 
44
-        if ($method->isStatic() || !$method->isPublic()) {
47
+        if ($method->isStatic() || !$method->isPublic())
48
+        {
45 49
             throw new ControllerException(
46 50
                 \sprintf('Invalid action `%s`->`%s`', $controller, $action),
47 51
                 ControllerException::BAD_ACTION
48 52
             );
49 53
         }
50 54
 
51
-        try {
55
+        try
56
+        {
52 57
             $args = $this->resolveArguments($method, $parameters);
53
-        } catch (ArgumentResolvingException|InvalidArgumentException $e) {
58
+        }
59
+        catch (ArgumentResolvingException|InvalidArgumentException $e)
60
+        {
54 61
             throw new ControllerException(
55 62
                 \sprintf('Missing/invalid parameter %s of `%s`->`%s`', $e->getParameter(), $controller, $action),
56 63
                 ControllerException::BAD_ARGUMENT,
57 64
                 $e
58 65
             );
59
-        } catch (ContainerExceptionInterface $e) {
66
+        }
67
+        catch (ContainerExceptionInterface $e)
68
+        {
60 69
             throw new ControllerException(
61 70
                 $e->getMessage(),
62 71
                 ControllerException::ERROR,
@@ -73,7 +82,8 @@  discard block
 block discarded – undo
73 82
 
74 83
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
75 84
     {
76
-        foreach ($method->getParameters() as $parameter) {
85
+        foreach ($method->getParameters() as $parameter)
86
+        {
77 87
             $name = $parameter->getName();
78 88
             if (
79 89
                 \array_key_exists($name, $parameters) &&
Please login to merge, or discard this patch.