Test Failed
Pull Request — master (#1190)
by butschster
10:27
created
src/Interceptors/src/Context/TargetInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,5 +58,5 @@
 block discarded – undo
58 58
      *
59 59
      * @return callable|array{class-string, non-empty-string}|null
60 60
      */
61
-    public function getCallable(): callable|array|null;
61
+    public function getCallable(): callable | array | null;
62 62
 }
Please login to merge, or discard this patch.
src/Interceptors/src/Event/InterceptorCalling.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
     public function __construct(
13 13
         public readonly CallContextInterface $context,
14 14
         public readonly InterceptorInterface $interceptor,
15
-    ) {
15
+    ){
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
src/Interceptors/src/Handler/InterceptorPipeline.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __construct(
29 29
         private readonly ?EventDispatcherInterface $dispatcher = null
30
-    ) {
30
+    ){
31 31
     }
32 32
 
33 33
     /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function withInterceptors(InterceptorInterface ...$interceptors): self
37 37
     {
38 38
         $clone = clone $this;
39
-        foreach ($interceptors as $interceptor) {
39
+        foreach ($interceptors as $interceptor){
40 40
             $clone->interceptors[] = $interceptor;
41 41
         }
42 42
 
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function handle(CallContextInterface $context): mixed
57 57
     {
58
-        if ($this->handler === null) {
58
+        if ($this->handler === null){
59 59
             throw new InterceptorException('Unable to invoke pipeline without last handler.');
60 60
         }
61 61
 
62
-        if (isset($this->interceptors[$this->position])) {
62
+        if (isset($this->interceptors[$this->position])){
63 63
             $interceptor = $this->interceptors[$this->position];
64 64
 
65 65
             $this->dispatcher?->dispatch(new InterceptorCalling(context: $context, interceptor: $interceptor));
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
     public function withInterceptors(InterceptorInterface ...$interceptors): self
37 37
     {
38 38
         $clone = clone $this;
39
-        foreach ($interceptors as $interceptor) {
39
+        foreach ($interceptors as $interceptor)
40
+        {
40 41
             $clone->interceptors[] = $interceptor;
41 42
         }
42 43
 
@@ -55,11 +56,13 @@  discard block
 block discarded – undo
55 56
      */
56 57
     public function handle(CallContextInterface $context): mixed
57 58
     {
58
-        if ($this->handler === null) {
59
+        if ($this->handler === null)
60
+        {
59 61
             throw new InterceptorException('Unable to invoke pipeline without last handler.');
60 62
         }
61 63
 
62
-        if (isset($this->interceptors[$this->position])) {
64
+        if (isset($this->interceptors[$this->position]))
65
+        {
63 66
             $interceptor = $this->interceptors[$this->position];
64 67
 
65 68
             $this->dispatcher?->dispatch(new InterceptorCalling(context: $context, interceptor: $interceptor));
Please login to merge, or discard this patch.
src/Hmvc/tests/Unit/Stub/MultipleCallNextInterceptor.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 
15 15
     public function __construct(
16 16
         private readonly int $counter,
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
21 21
     {
22 22
         $this->result = [];
23
-        for ($i = 0; $i < $this->counter; ++$i) {
23
+        for ($i = 0; $i < $this->counter; ++$i){
24 24
             $this->result[] = $handler->handle($context);
25 25
         }
26 26
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
     public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
21 21
     {
22 22
         $this->result = [];
23
-        for ($i = 0; $i < $this->counter; ++$i) {
23
+        for ($i = 0; $i < $this->counter; ++$i)
24
+        {
24 25
             $this->result[] = $handler->handle($context);
25 26
         }
26 27
 
Please login to merge, or discard this patch.
src/Hmvc/src/CompatiblePipelineBuilder.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
     public function withInterceptors(CoreInterceptorInterface|InterceptorInterface ...$interceptors): static
32 32
     {
33 33
         $clone = clone $this;
34
-        foreach ($interceptors as $interceptor) {
34
+        foreach ($interceptors as $interceptor)
35
+        {
35 36
             $clone->pipeline->addInterceptor($interceptor);
36 37
         }
37 38
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
         $this->pipeline = clone $this->pipeline;
29 29
     }
30 30
 
31
-    public function withInterceptors(CoreInterceptorInterface|InterceptorInterface ...$interceptors): static
31
+    public function withInterceptors(CoreInterceptorInterface | InterceptorInterface ...$interceptors): static
32 32
     {
33 33
         $clone = clone $this;
34
-        foreach ($interceptors as $interceptor) {
34
+        foreach ($interceptors as $interceptor){
35 35
             $clone->pipeline->addInterceptor($interceptor);
36 36
         }
37 37
 
38 38
         return $clone;
39 39
     }
40 40
 
41
-    public function build(HandlerInterface|CoreInterface $handler): InterceptorPipeline
41
+    public function build(HandlerInterface | CoreInterface $handler): InterceptorPipeline
42 42
     {
43 43
         /** @psalm-suppress InvalidArgument */
44 44
         return $handler instanceof HandlerInterface
Please login to merge, or discard this patch.
src/Hmvc/src/Exception/ControllerException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 // Load the original class to make an alias
8 8
 use Spiral\Interceptors\Exception\TargetCallException;
9 9
 
10
-if (!\class_exists(TargetCallException::class)) {
10
+if (!\class_exists(TargetCallException::class)){
11 11
     /**
12 12
      * Unable to perform user action or find controller.
13 13
      *
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,8 @@
 block discarded – undo
7 7
 // Load the original class to make an alias
8 8
 use Spiral\Interceptors\Exception\TargetCallException;
9 9
 
10
-if (!\class_exists(TargetCallException::class)) {
10
+if (!\class_exists(TargetCallException::class))
11
+{
11 12
     /**
12 13
      * Unable to perform user action or find controller.
13 14
      *
Please login to merge, or discard this patch.
src/Hmvc/src/Exception/InterceptorException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 namespace Spiral\Core\Exception;
6 6
 
7 7
 // Load the original class to make an alias
8
-if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)) {
8
+if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)){
9 9
     /**
10 10
      * @deprecated will be removed in Spiral v4.0
11 11
      * Use {@see \Spiral\Interceptors\Exception\InterceptorException} instead.
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
 namespace Spiral\Core\Exception;
6 6
 
7 7
 // Load the original class to make an alias
8
-if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)) {
8
+if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class))
9
+{
9 10
     /**
10 11
      * @deprecated will be removed in Spiral v4.0
11 12
      * Use {@see \Spiral\Interceptors\Exception\InterceptorException} instead.
Please login to merge, or discard this patch.
src/Hmvc/src/InterceptorPipeline.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function __construct(
33 33
         private readonly ?EventDispatcherInterface $dispatcher = null
34
-    ) {
34
+    ){
35 35
     }
36 36
 
37
-    public function addInterceptor(CoreInterceptorInterface|InterceptorInterface $interceptor): void
37
+    public function addInterceptor(CoreInterceptorInterface | InterceptorInterface $interceptor): void
38 38
     {
39 39
         $this->interceptors[] = $interceptor;
40 40
     }
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function callAction(string $controller, string $action, array $parameters = []): mixed
68 68
     {
69
-        if ($this->context === null) {
69
+        if ($this->context === null){
70 70
             return $this->handle(
71 71
                 new CallContext(Target::fromPathArray([$controller, $action]), $parameters),
72 72
             );
73 73
         }
74 74
 
75
-        if ($this->context->getTarget()->getPath() === [$controller, $action]) {
75
+        if ($this->context->getTarget()->getPath() === [$controller, $action]){
76 76
             return $this->handle($this->context->withArguments($parameters));
77 77
         }
78 78
 
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function handle(CallContextInterface $context): mixed
90 90
     {
91
-        if ($this->core === null && $this->handler === null) {
91
+        if ($this->core === null && $this->handler === null){
92 92
             throw new InterceptorException('Unable to invoke pipeline without last handler.');
93 93
         }
94 94
 
95 95
         $path = $context->getTarget()->getPath();
96 96
 
97
-        if (isset($this->interceptors[$this->position])) {
97
+        if (isset($this->interceptors[$this->position])){
98 98
             $interceptor = $this->interceptors[$this->position];
99 99
             $handler = $this->nextWithContext($context);
100 100
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,13 +66,15 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function callAction(string $controller, string $action, array $parameters = []): mixed
68 68
     {
69
-        if ($this->context === null) {
69
+        if ($this->context === null)
70
+        {
70 71
             return $this->handle(
71 72
                 new CallContext(Target::fromPathArray([$controller, $action]), $parameters),
72 73
             );
73 74
         }
74 75
 
75
-        if ($this->context->getTarget()->getPath() === [$controller, $action]) {
76
+        if ($this->context->getTarget()->getPath() === [$controller, $action])
77
+        {
76 78
             return $this->handle($this->context->withArguments($parameters));
77 79
         }
78 80
 
@@ -88,13 +90,15 @@  discard block
 block discarded – undo
88 90
      */
89 91
     public function handle(CallContextInterface $context): mixed
90 92
     {
91
-        if ($this->core === null && $this->handler === null) {
93
+        if ($this->core === null && $this->handler === null)
94
+        {
92 95
             throw new InterceptorException('Unable to invoke pipeline without last handler.');
93 96
         }
94 97
 
95 98
         $path = $context->getTarget()->getPath();
96 99
 
97
-        if (isset($this->interceptors[$this->position])) {
100
+        if (isset($this->interceptors[$this->position]))
101
+        {
98 102
             $interceptor = $this->interceptors[$this->position];
99 103
             $handler = $this->nextWithContext($context);
100 104
 
Please login to merge, or discard this patch.
src/Hmvc/src/InterceptableCore.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
     public function __construct(
22 22
         private readonly CoreInterface $core,
23 23
         ?EventDispatcherInterface $dispatcher = null
24
-    ) {
24
+    ){
25 25
         $this->pipeline = new InterceptorPipeline($dispatcher);
26 26
     }
27 27
 
28
-    public function addInterceptor(CoreInterceptorInterface|InterceptorInterface $interceptor): void
28
+    public function addInterceptor(CoreInterceptorInterface | InterceptorInterface $interceptor): void
29 29
     {
30 30
         $this->pipeline->addInterceptor($interceptor);
31 31
     }
Please login to merge, or discard this patch.