Passed
Pull Request — master (#1111)
by Aleksei
11:44
created
src/Hmvc/src/Interceptors/Handler/InterceptorPipeline.php 1 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(CallContext $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/Interceptors/Unit/Handler/InterceptorPipelineTest.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
     public function testInterceptorCallingEventShouldBeDispatched(): void
21 21
     {
22 22
         $context = $this->createPathContext(['test', 'test2']);
23
-        $interceptor = new class implements InterceptorInterface {
23
+        $interceptor = new class implements InterceptorInterface
24
+        {
24 25
             public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
25 26
             {
26 27
                 return null;
@@ -39,7 +40,8 @@  discard block
 block discarded – undo
39 40
         $pipeline = $this->createPipeline(interceptors: [$interceptor], dispatcher: $dispatcher);
40 41
 
41 42
         $pipeline->withHandler(
42
-            new class implements HandlerInterface {
43
+            new class implements HandlerInterface
44
+            {
43 45
                 public function handle(CallContext $context): mixed
44 46
                 {
45 47
                     return null;
Please login to merge, or discard this patch.
src/Hmvc/src/Core/CompatiblePipelineBuilder.php 1 patch
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.
src/Console/src/CommandCoreFactory.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@
 block discarded – undo
36 36
         $pipelineBuilder ??= new CompatiblePipelineBuilder($eventDispatcher);
37 37
 
38 38
         $resolved = [];
39
-        foreach ($interceptors as $interceptor) {
39
+        foreach ($interceptors as $interceptor)
40
+        {
40 41
             $resolved[] = $this->container->get($interceptor);
41 42
         }
42 43
 
Please login to merge, or discard this patch.
src/Queue/src/QueueManager.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
         // Replaces alias with real pipeline name
37 37
         $name = $this->config->getAliases()[$name] ?? $name;
38 38
 
39
-        if (!isset($this->pipelines[$name])) {
39
+        if (!isset($this->pipelines[$name]))
40
+        {
40 41
             $this->pipelines[$name] = $this->resolveConnection($name);
41 42
         }
42 43
 
@@ -51,18 +52,22 @@  discard block
 block discarded – undo
51 52
     {
52 53
         $config = $this->config->getConnection($name);
53 54
 
54
-        try {
55
+        try
56
+        {
55 57
             $driver = $this->factory->make($config['driver'], $config);
56 58
 
57 59
             $list = [];
58
-            foreach ($this->config->getPushInterceptors() as $interceptor) {
60
+            foreach ($this->config->getPushInterceptors() as $interceptor)
61
+            {
59 62
                 $list[] = \is_string($interceptor) || $interceptor instanceof Autowire
60 63
                     ? $this->container->get($interceptor)
61 64
                     : $interceptor;
62 65
             }
63 66
 
64 67
             return new Queue($this->builder->withInterceptors(...$list)->build(new PushCore($driver)));
65
-        } catch (ContainerException $e) {
68
+        }
69
+        catch (ContainerException $e)
70
+        {
66 71
             throw new Exception\NotSupportedDriverException(
67 72
                 \sprintf(
68 73
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this patch.
src/Queue/src/Bootloader/QueueBootloader.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,11 +73,13 @@  discard block
 block discarded – undo
73 73
             $registry = $container->get(QueueRegistry::class);
74 74
             $config = $container->get(QueueConfig::class);
75 75
 
76
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
76
+            foreach ($config->getRegistryHandlers() as $jobType => $handler)
77
+            {
77 78
                 $registry->setHandler($jobType, $handler);
78 79
             }
79 80
 
80
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
81
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer)
82
+            {
81 83
                 $registry->setSerializer($jobType, $serializer);
82 84
             }
83 85
         });
@@ -147,10 +149,14 @@  discard block
 block discarded – undo
147 149
         $builder ??= new CompatiblePipelineBuilder($dispatcher);
148 150
 
149 151
         $list = [];
150
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
151
-            if (\is_string($interceptor)) {
152
+        foreach ($config->getConsumeInterceptors() as $interceptor)
153
+        {
154
+            if (\is_string($interceptor))
155
+            {
152 156
                 $list[] = $container->get($interceptor);
153
-            } elseif ($interceptor instanceof Autowire) {
157
+            }
158
+            elseif ($interceptor instanceof Autowire)
159
+            {
154 160
                 $list[] = $interceptor->resolve($factory);
155 161
             }
156 162
         }
Please login to merge, or discard this patch.
src/Framework/Bootloader/DomainBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@
 block discarded – undo
32 32
         $builder = new CompatiblePipelineBuilder($dispatcher);
33 33
 
34 34
         $list = [];
35
-        foreach (static::defineInterceptors() as $interceptor) {
35
+        foreach (static::defineInterceptors() as $interceptor)
36
+        {
36 37
             $list[] = $interceptor instanceof CoreInterceptorInterface || $interceptor instanceof InterceptorInterface
37 38
                 ? $interceptor
38 39
                 : $container->get($interceptor);
Please login to merge, or discard this patch.
src/Framework/Bootloader/Security/FiltersBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,8 @@
 block discarded – undo
116 116
         $builder ??= new CompatiblePipelineBuilder($dispatcher);
117 117
 
118 118
         $list = [];
119
-        foreach ($config->getInterceptors() as $interceptor) {
119
+        foreach ($config->getInterceptors() as $interceptor)
120
+        {
120 121
             $list[] = $container->get($interceptor);
121 122
         }
122 123
 
Please login to merge, or discard this patch.
src/Events/src/Bootloader/EventsBootloader.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,11 +72,13 @@  discard block
 block discarded – undo
72 72
         FinalizerInterface $finalizer,
73 73
         ?EventDispatcherInterface $eventDispatcher = null
74 74
     ): void {
75
-        if ($eventDispatcher !== null) {
75
+        if ($eventDispatcher !== null)
76
+        {
76 77
             $this->initEventDispatcher(new Core($eventDispatcher), $config, $container, $factory);
77 78
         }
78 79
 
79
-        foreach ($config->getProcessors() as $processor) {
80
+        foreach ($config->getProcessors() as $processor)
81
+        {
80 82
             $processor = $this->autowire($processor, $container, $factory);
81 83
 
82 84
             \assert($processor instanceof ProcessorInterface);
@@ -87,7 +89,8 @@  discard block
 block discarded – undo
87 89
             $registry->process();
88 90
         });
89 91
 
90
-        if ($finalizer instanceof EventDispatcherAwareInterface && $eventDispatcher !== null) {
92
+        if ($finalizer instanceof EventDispatcherAwareInterface && $eventDispatcher !== null)
93
+        {
91 94
             $finalizer->setEventDispatcher($eventDispatcher);
92 95
         }
93 96
     }
@@ -109,7 +112,8 @@  discard block
 block discarded – undo
109 112
     ): void {
110 113
         $builder = new CompatiblePipelineBuilder();
111 114
         $list = [];
112
-        foreach ($config->getInterceptors() as $interceptor) {
115
+        foreach ($config->getInterceptors() as $interceptor)
116
+        {
113 117
             $list[] = $this->autowire($interceptor, $container, $factory);
114 118
         }
115 119
 
Please login to merge, or discard this patch.