Passed
Pull Request — master (#1111)
by Aleksei
10:58
created
src/Hmvc/src/Interceptors/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(CallContext $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(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 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  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
             public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
25 25
             {
26 26
                 return null;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $pipeline = $this->createPipeline(interceptors: [$interceptor], dispatcher: $dispatcher);
40 40
 
41 41
         $pipeline->withHandler(
42
-            new class implements HandlerInterface {
42
+            new class implements HandlerInterface{
43 43
                 public function handle(CallContext $context): mixed
44 44
                 {
45 45
                     return null;
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private function createPipeline(
127 127
         array $interceptors = [],
128
-        HandlerInterface|null $lastHandler = null,
129
-        EventDispatcherInterface|null $dispatcher = null,
128
+        HandlerInterface | null $lastHandler = null,
129
+        EventDispatcherInterface | null $dispatcher = null,
130 130
     ): InterceptorPipeline {
131 131
         $pipeline = new InterceptorPipeline($dispatcher);
132 132
 
Please login to merge, or discard this 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/Interceptors/Context/Target.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
         private ?\ReflectionFunctionAbstract $reflection = null,
21 21
         private readonly ?object $object = null,
22 22
         private string $delimiter = '.',
23
-        private \Closure|array|null $callable = null,
24
-    ) {
23
+        private \Closure | array | null $callable = null,
24
+    ){
25 25
     }
26 26
 
27 27
     public function __toString(): string
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function fromReflectionMethod(
47 47
         \ReflectionFunctionAbstract $reflection,
48
-        string|object $classOrObject,
48
+        string | object $classOrObject,
49 49
     ): self {
50 50
         $method = $reflection->getName();
51 51
         $isStatic = $reflection->isStatic();
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
         /** @var self<T> $result */
54 54
         $result = \is_object($classOrObject)
55 55
             ? new self(
56
-                path: [$classOrObject::class, $method],
57
-                reflection: $reflection,
58
-                object: $classOrObject,
59
-                delimiter: $isStatic ? '::' : '->',
60
-                callable: [$classOrObject, $method],
56
+                path : [$classOrObject::class, $method],
57
+                reflection : $reflection,
58
+                object : $classOrObject,
59
+                delimiter : $isStatic ? '::' : '->',
60
+                callable : [$classOrObject, $method],
61 61
             )
62 62
             : new self(
63
-                path: [$classOrObject, $method],
64
-                reflection: $reflection,
65
-                delimiter: $isStatic ? '::' : '->',
66
-                callable: [$classOrObject, $method],
63
+                path : [$classOrObject, $method],
64
+                reflection : $reflection,
65
+                delimiter : $isStatic ? '::' : '->',
66
+                callable : [$classOrObject, $method],
67 67
             );
68 68
         return $result;
69 69
     }
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return ($controller is class-string|T ? self<T> : self<null>)
135 135
      */
136
-    public static function fromPair(string|object $controller, string $action): self
136
+    public static function fromPair(string | object $controller, string $action): self
137 137
     {
138 138
         /** @psalm-suppress ArgumentTypeCoercion */
139
-        if (\is_object($controller) || \method_exists($controller, $action)) {
139
+        if (\is_object($controller) || \method_exists($controller, $action)){
140 140
             /** @var T|class-string<T> $controller */
141 141
             return self::fromReflectionMethod(new \ReflectionMethod($controller, $action), $controller);
142 142
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         return $this->object;
168 168
     }
169 169
 
170
-    public function getCallable(): callable|array|null
170
+    public function getCallable(): callable | array | null
171 171
     {
172 172
         return $this->callable;
173 173
     }
Please login to merge, or discard this patch.
src/Hmvc/src/Interceptors/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/Hmvc/src/Core/CompatiblePipelineBuilder.php 2 patches
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 $last): InterceptorPipeline
41
+    public function build(HandlerInterface | CoreInterface $last): InterceptorPipeline
42 42
     {
43 43
         /** @psalm-suppress InvalidArgument */
44 44
         return $last instanceof HandlerInterface
Please login to merge, or discard this 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 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 {
21 21
     public function __construct(
22 22
         private readonly ContainerInterface $container,
23
-    ) {
23
+    ){
24 24
     }
25 25
 
26 26
     /**
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
         array $interceptors,
31 31
         ?EventDispatcherInterface $eventDispatcher = null,
32 32
         ?PipelineBuilderInterface $pipelineBuilder = null,
33
-    ): CoreInterface|HandlerInterface {
33
+    ): CoreInterface | HandlerInterface {
34 34
         /** @var CommandCore $core */
35 35
         $core = $this->container->get(CommandCore::class);
36 36
         $pipelineBuilder ??= new CompatiblePipelineBuilder($eventDispatcher);
37 37
 
38 38
         $resolved = [];
39
-        foreach ($interceptors as $interceptor) {
39
+        foreach ($interceptors as $interceptor){
40 40
             $resolved[] = $this->container->get($interceptor);
41 41
         }
42 42
 
Please login to merge, or discard this 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/Console/src/Command.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
      */
84 84
     protected function execute(InputInterface $input, OutputInterface $output): int
85 85
     {
86
-        if ($this->container === null) {
86
+        if ($this->container === null){
87 87
             throw new ScopeException('Container is not set');
88 88
         }
89 89
 
90 90
         $method = method_exists($this, 'perform') ? 'perform' : '__invoke';
91 91
 
92
-        try {
92
+        try{
93 93
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
94 94
 
95 95
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
123 123
 
124 124
             return $code;
125
-        } finally {
125
+        }finally{
126 126
             [$this->input, $this->output] = [null, null];
127 127
         }
128 128
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * @deprecated This method will be removed in v4.0.
132 132
      */
133
-    protected function buildCore(): CoreInterface|HandlerInterface
133
+    protected function buildCore(): CoreInterface | HandlerInterface
134 134
     {
135 135
         /** @var InvokerInterface $invoker */
136 136
         $invoker = $this->container->get(InvokerInterface::class);
Please login to merge, or discard this patch.
src/Queue/src/QueueManager.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         private readonly FactoryInterface $factory,
27 27
         ?EventDispatcherInterface $dispatcher = null,
28 28
         ?PipelineBuilderInterface $builder = null,
29
-    ) {
29
+    ){
30 30
         $this->builder = $builder ?? new CompatiblePipelineBuilder($dispatcher);
31 31
     }
32 32
 
@@ -36,7 +36,7 @@  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
             $this->pipelines[$name] = $this->resolveConnection($name);
41 41
         }
42 42
 
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $config = $this->config->getConnection($name);
53 53
 
54
-        try {
54
+        try{
55 55
             $driver = $this->factory->make($config['driver'], $config);
56 56
 
57 57
             $list = [];
58
-            foreach ($this->config->getPushInterceptors() as $interceptor) {
58
+            foreach ($this->config->getPushInterceptors() as $interceptor){
59 59
                 $list[] = \is_string($interceptor) || $interceptor instanceof Autowire
60 60
                     ? $this->container->get($interceptor)
61 61
                     : $interceptor;
62 62
             }
63 63
 
64 64
             return new Queue($this->builder->withInterceptors(...$list)->build(new PushCore($driver)));
65
-        } catch (ContainerException $e) {
65
+        }catch (ContainerException $e){
66 66
             throw new Exception\NotSupportedDriverException(
67 67
                 \sprintf(
68 68
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this 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 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function __construct(
57 57
         private readonly ConfiguratorInterface $config,
58
-    ) {
58
+    ){
59 59
     }
60 60
 
61 61
     public function init(
@@ -73,11 +73,11 @@  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
                 $registry->setHandler($jobType, $handler);
78 78
             }
79 79
 
80
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
80
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer){
81 81
                 $registry->setSerializer($jobType, $serializer);
82 82
             }
83 83
         });
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     /**
96 96
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
97 97
      */
98
-    public function addConsumeInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
98
+    public function addConsumeInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
99 99
     {
100 100
         $this->config->modify(
101 101
             QueueConfig::CONFIG,
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     /**
107 107
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
108 108
      */
109
-    public function addPushInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
109
+    public function addPushInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
110 110
     {
111 111
         $this->config->modify(
112 112
             QueueConfig::CONFIG,
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         ContainerInterface $container,
132 132
         FactoryInterface $factory,
133 133
         ContainerRegistry $registry,
134
-    ) {
134
+    ){
135 135
         return new QueueRegistry($container, $factory, $registry);
136 136
     }
137 137
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
         $builder ??= new CompatiblePipelineBuilder($dispatcher);
148 148
 
149 149
         $list = [];
150
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
151
-            if (\is_string($interceptor)) {
150
+        foreach ($config->getConsumeInterceptors() as $interceptor){
151
+            if (\is_string($interceptor)){
152 152
                 $list[] = $container->get($interceptor);
153
-            } elseif ($interceptor instanceof Autowire) {
153
+            } elseif ($interceptor instanceof Autowire){
154 154
                 $list[] = $interceptor->resolve($factory);
155 155
             }
156 156
         }
Please login to merge, or discard this 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.