Passed
Pull Request — master (#933)
by Maxim
36:02 queued 25:52
created
src/Hmvc/src/AbstractCore.php 1 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.