Passed
Pull Request — master (#1104)
by Aleksei
26:20
created
src/Router/src/RouteGroup.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     /** @var array<MiddlewareType> */
29 29
     private array $middleware = [];
30 30
 
31
-    private Autowire|HandlerInterface|CoreInterface|string|null $core = null;
31
+    private Autowire | HandlerInterface | CoreInterface | string | null $core = null;
32 32
 
33 33
     public function __construct(
34 34
         /** @deprecated since v3.3.0 */
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         private readonly ?RouterInterface $router = null,
38 38
         /** @deprecated since v3.3.0 */
39 39
         private readonly ?UriHandler $handler = null
40
-    ) {
40
+    ){
41 41
     }
42 42
 
43 43
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         return $this;
69 69
     }
70 70
 
71
-    public function setCore(Autowire|CoreInterface|HandlerInterface|string $core): self
71
+    public function setCore(Autowire | CoreInterface | HandlerInterface | string $core): self
72 72
     {
73 73
         $this->core = $core;
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * @param MiddlewareType $middleware
80 80
      */
81
-    public function addMiddleware(MiddlewareInterface|Autowire|string $middleware): self
81
+    public function addMiddleware(MiddlewareInterface | Autowire | string $middleware): self
82 82
     {
83 83
         $this->middleware[] = $middleware;
84 84
 
@@ -92,21 +92,21 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function register(RouterInterface $router, FactoryInterface $factory): void
94 94
     {
95
-        foreach ($this->routes as $name => $route) {
96
-            if ($this->core !== null) {
97
-                if (!$this->core instanceof CoreInterface && !$this->core instanceof HandlerInterface) {
95
+        foreach ($this->routes as $name => $route){
96
+            if ($this->core !== null){
97
+                if (!$this->core instanceof CoreInterface && !$this->core instanceof HandlerInterface){
98 98
                     $this->core = $factory->make($this->core);
99 99
                 }
100 100
 
101 101
                 $target = $route->getTarget();
102
-                if ($target instanceof AbstractTarget) {
102
+                if ($target instanceof AbstractTarget){
103 103
                     $route = $route->withTarget($target->withCore($this->core));
104 104
                 }
105 105
             }
106 106
 
107
-            try {
107
+            try{
108 108
                 $uriHandler = $route->getUriHandler();
109
-            } catch (\Throwable) {
109
+            }catch (\Throwable){
110 110
                 $uriHandler = $factory->make(UriHandler::class);
111 111
             }
112 112
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         \assert($route instanceof Route);
132 132
 
133
-        $this->routes[$this->namePrefix . $name] = $route;
133
+        $this->routes[$this->namePrefix.$name] = $route;
134 134
 
135 135
         return $this;
136 136
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,21 +92,28 @@
 block discarded – undo
92 92
      */
93 93
     public function register(RouterInterface $router, FactoryInterface $factory): void
94 94
     {
95
-        foreach ($this->routes as $name => $route) {
96
-            if ($this->core !== null) {
97
-                if (!$this->core instanceof CoreInterface && !$this->core instanceof HandlerInterface) {
95
+        foreach ($this->routes as $name => $route)
96
+        {
97
+            if ($this->core !== null)
98
+            {
99
+                if (!$this->core instanceof CoreInterface && !$this->core instanceof HandlerInterface)
100
+                {
98 101
                     $this->core = $factory->make($this->core);
99 102
                 }
100 103
 
101 104
                 $target = $route->getTarget();
102
-                if ($target instanceof AbstractTarget) {
105
+                if ($target instanceof AbstractTarget)
106
+                {
103 107
                     $route = $route->withTarget($target->withCore($this->core));
104 108
                 }
105 109
             }
106 110
 
107
-            try {
111
+            try
112
+            {
108 113
                 $uriHandler = $route->getUriHandler();
109
-            } catch (\Throwable) {
114
+            }
115
+            catch (\Throwable)
116
+            {
110 117
                 $uriHandler = $factory->make(UriHandler::class);
111 118
             }
112 119
 
Please login to merge, or discard this patch.
src/Router/src/Target/AbstractTarget.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     // Automatically prepend HTTP verb to all action names.
26 26
     public const RESTFUL = 1;
27 27
 
28
-    private HandlerInterface|CoreInterface|null $pipeline = null;
28
+    private HandlerInterface | CoreInterface | null $pipeline = null;
29 29
     private ?CoreHandler $handler = null;
30 30
     private bool $verbActions;
31 31
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         private array $constrains,
35 35
         int $options = 0,
36 36
         private string $defaultAction = 'index'
37
-    ) {
37
+    ){
38 38
         $this->verbActions = ($options & self::RESTFUL) === self::RESTFUL;
39 39
     }
40 40
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @mutation-free
53 53
      * @deprecated Use {@see withHandler()} instead.
54 54
      */
55
-    public function withCore(HandlerInterface|CoreInterface $core): TargetInterface
55
+    public function withCore(HandlerInterface | CoreInterface $core): TargetInterface
56 56
     {
57 57
         $target = clone $this;
58 58
         $target->pipeline = $core;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
     protected function coreHandler(ContainerInterface $container): CoreHandler
86 86
     {
87
-        if ($this->handler !== null) {
87
+        if ($this->handler !== null){
88 88
             return $this->handler;
89 89
         }
90 90
 
91
-        try {
91
+        try{
92 92
             // construct on demand
93 93
             $this->handler = new CoreHandler(
94 94
                 $this->pipeline ?? $container->get(HandlerInterface::class),
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             );
99 99
 
100 100
             return $this->handler;
101
-        } catch (ContainerExceptionInterface $e) {
101
+        }catch (ContainerExceptionInterface $e){
102 102
             throw new TargetException($e->getMessage(), $e->getCode(), $e);
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,11 +84,13 @@  discard block
 block discarded – undo
84 84
 
85 85
     protected function coreHandler(ContainerInterface $container): CoreHandler
86 86
     {
87
-        if ($this->handler !== null) {
87
+        if ($this->handler !== null)
88
+        {
88 89
             return $this->handler;
89 90
         }
90 91
 
91
-        try {
92
+        try
93
+        {
92 94
             // construct on demand
93 95
             $this->handler = new CoreHandler(
94 96
                 $this->pipeline ?? $container->get(HandlerInterface::class),
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
             );
99 101
 
100 102
             return $this->handler;
101
-        } catch (ContainerExceptionInterface $e) {
103
+        }
104
+        catch (ContainerExceptionInterface $e)
105
+        {
102 106
             throw new TargetException($e->getMessage(), $e->getCode(), $e);
103 107
         }
104 108
     }
Please login to merge, or discard this patch.
src/Scaffolder/src/Declaration/BootloaderDeclaration.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         ?string $comment = null,
24 24
         ?string $namespace = null,
25 25
         private readonly bool $isDomain = false,
26
-    ) {
26
+    ){
27 27
         parent::__construct($config, $name, $comment, $namespace);
28 28
     }
29 29
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $this->class->addConstant('SINGLETONS', [])->setProtected();
44 44
         $this->class->addConstant('DEPENDENCIES', [])->setProtected();
45 45
 
46
-        if ($this->isDomain) {
46
+        if ($this->isDomain){
47 47
             $this->class->addConstant('INTERCEPTORS', [])->setProtected();
48 48
             $this->namespace->addUse(HandlerInterface::class);
49 49
             $this->class->getConstant('SINGLETONS')->setValue([
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
         $this->class->addConstant('SINGLETONS', [])->setProtected();
44 44
         $this->class->addConstant('DEPENDENCIES', [])->setProtected();
45 45
 
46
-        if ($this->isDomain) {
46
+        if ($this->isDomain)
47
+        {
47 48
             $this->class->addConstant('INTERCEPTORS', [])->setProtected();
48 49
             $this->namespace->addUse(HandlerInterface::class);
49 50
             $this->class->getConstant('SINGLETONS')->setValue([
Please login to merge, or discard this patch.
src/Events/src/EventDispatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 {
15 15
     private readonly bool $isLegacy;
16 16
     public function __construct(
17
-        private readonly HandlerInterface|CoreInterface $core
18
-    ) {
17
+        private readonly HandlerInterface | CoreInterface $core
18
+    ){
19 19
         $this->isLegacy = !$core instanceof HandlerInterface;
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/DomainBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
     ): CoreInterface&HandlerInterface {
32 32
         $pipeline = (new InterceptorPipeline($dispatcher))->withCore($core);
33 33
 
34
-        foreach (static::defineInterceptors() as $interceptor) {
35
-            if (!$interceptor instanceof CoreInterceptorInterface && !$interceptor instanceof InterceptorInterface) {
34
+        foreach (static::defineInterceptors() as $interceptor){
35
+            if (!$interceptor instanceof CoreInterceptorInterface && !$interceptor instanceof InterceptorInterface){
36 36
                 $interceptor = $container->get($interceptor);
37 37
             }
38 38
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,10 @@
 block discarded – undo
31 31
     ): CoreInterface&HandlerInterface {
32 32
         $pipeline = (new InterceptorPipeline($dispatcher))->withCore($core);
33 33
 
34
-        foreach (static::defineInterceptors() as $interceptor) {
35
-            if (!$interceptor instanceof CoreInterceptorInterface && !$interceptor instanceof InterceptorInterface) {
34
+        foreach (static::defineInterceptors() as $interceptor)
35
+        {
36
+            if (!$interceptor instanceof CoreInterceptorInterface && !$interceptor instanceof InterceptorInterface)
37
+            {
36 38
                 $interceptor = $container->get($interceptor);
37 39
             }
38 40
 
Please login to merge, or discard this patch.
src/Queue/src/Interceptor/Consume/Handler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
     private readonly bool $isLegacy;
24 24
 
25 25
     public function __construct(
26
-        private readonly HandlerInterface|CoreInterface $core,
26
+        private readonly HandlerInterface | CoreInterface $core,
27 27
         ?TracerFactoryInterface $tracerFactory = null,
28
-    ) {
28
+    ){
29 29
         $this->tracerFactory = $tracerFactory ?? new NullTracerFactory(new Container());
30 30
         $this->isLegacy = !$core instanceof HandlerInterface;
31 31
     }
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
         return $tracer->trace(
52 52
             name: \sprintf('Job handling [%s:%s]', $name, $id),
53 53
             callback: $this->isLegacy
54
-                ? fn (): mixed => $this->core->callAction($name, 'handle', $arguments)
55
-                : fn (): mixed => $this->core->handle(new CallContext(Target::fromPair($name, 'handle'), $arguments)),
56
-            attributes: [
54
+                ? fn () : mixed => $this->core->callAction($name, 'handle', $arguments)
55
+                : fn () : mixed => $this->core->handle(new CallContext(Target::fromPair($name, 'handle'), $arguments)),
56
+            attributes : [
57 57
                 'queue.driver' => $driver,
58 58
                 'queue.name' => $queue,
59 59
                 'queue.id' => $id,
60 60
                 'queue.headers' => $headers,
61 61
             ],
62
-            scoped: true,
63
-            traceKind: TraceKind::CONSUMER,
62
+            scoped : true,
63
+            traceKind : TraceKind::CONSUMER,
64 64
         );
65 65
     }
66 66
 }
Please login to merge, or discard this patch.
src/Queue/src/Interceptor/Consume/ErrorHandlerInterceptor.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 {
17 17
     public function __construct(
18 18
         private readonly FailedJobHandlerInterface $handler
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     /** @psalm-suppress ParamNameMismatch */
23 23
     public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed
24 24
     {
25
-        try {
25
+        try{
26 26
             return $core->callAction($name, $action, $parameters);
27
-        } catch (\Throwable $e) {
28
-            if (!$e instanceof StateException) {
27
+        }catch (\Throwable $e){
28
+            if (!$e instanceof StateException){
29 29
                 $this->handler->handle(
30 30
                     $parameters['driver'],
31 31
                     $parameters['queue'],
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
43 43
     {
44
-        try {
44
+        try{
45 45
             return $handler->handle($context);
46
-        } catch (\Throwable $e) {
46
+        }catch (\Throwable $e){
47 47
             $args = $context->getArguments();
48
-            if (!$e instanceof StateException) {
48
+            if (!$e instanceof StateException){
49 49
                 $this->handler->handle(
50 50
                     $args['driver'],
51 51
                     $args['queue'],
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,10 +22,14 @@  discard block
 block discarded – undo
22 22
     /** @psalm-suppress ParamNameMismatch */
23 23
     public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed
24 24
     {
25
-        try {
25
+        try
26
+        {
26 27
             return $core->callAction($name, $action, $parameters);
27
-        } catch (\Throwable $e) {
28
-            if (!$e instanceof StateException) {
28
+        }
29
+        catch (\Throwable $e)
30
+        {
31
+            if (!$e instanceof StateException)
32
+            {
29 33
                 $this->handler->handle(
30 34
                     $parameters['driver'],
31 35
                     $parameters['queue'],
@@ -41,11 +45,15 @@  discard block
 block discarded – undo
41 45
 
42 46
     public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed
43 47
     {
44
-        try {
48
+        try
49
+        {
45 50
             return $handler->handle($context);
46
-        } catch (\Throwable $e) {
51
+        }
52
+        catch (\Throwable $e)
53
+        {
47 54
             $args = $context->getArguments();
48
-            if (!$e instanceof StateException) {
55
+            if (!$e instanceof StateException)
56
+            {
49 57
                 $this->handler->handle(
50 58
                     $args['driver'],
51 59
                     $args['queue'],
Please login to merge, or discard this patch.
src/Filters/src/Model/FilterProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
     public function __construct(
27 27
         private readonly ContainerInterface $container,
28 28
         private readonly ResolverInterface $resolver,
29
-        private readonly HandlerInterface|CoreInterface $core
30
-    ) {
29
+        private readonly HandlerInterface | CoreInterface $core
30
+    ){
31 31
         $this->isLegacy = !$core instanceof HandlerInterface;
32 32
     }
33 33
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $filter = $this->createFilterInstance($name);
40 40
         [$mappingSchema, $errors, $setters, $optionalFilters] = $attributeMapper->map($filter, $input);
41 41
 
42
-        if ($filter instanceof HasFilterDefinition) {
42
+        if ($filter instanceof HasFilterDefinition){
43 43
             $mappingSchema = \array_merge(
44 44
                 $mappingSchema,
45 45
                 $filter->filterDefinition()->mappingSchema()
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         \assert($schemaBuilder instanceof Builder);
54 54
 
55 55
         $schema = $schemaBuilder->makeSchema($name, $mappingSchema);
56
-        foreach ($optionalFilters as $optionalFilter) {
56
+        foreach ($optionalFilters as $optionalFilter){
57 57
             $schema[$optionalFilter][Builder::SCHEMA_OPTIONAL] = true;
58 58
         }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $class = new \ReflectionClass($name);
75 75
 
76 76
         $args = [];
77
-        if ($constructor = $class->getConstructor()) {
77
+        if ($constructor = $class->getConstructor()){
78 78
             $args = $this->resolver->resolveArguments($constructor);
79 79
         }
80 80
 
Please login to merge, or discard this patch.
src/Telemetry/src/NullTracerFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 {
18 18
     public function __construct(
19 19
         #[Proxy] private readonly ?ScopeInterface $scope = new Container(),
20
-    ) {
20
+    ){
21 21
     }
22 22
 
23 23
     public function make(array $context = []): TracerInterface
Please login to merge, or discard this patch.