Test Failed
Pull Request — master (#1190)
by butschster
10:27
created
src/Filters/src/Model/Mapper/Mapper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function __construct(
15 15
         private readonly CasterRegistryInterface $registry
16
-    ) {
16
+    ){
17 17
     }
18 18
 
19 19
     /**
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
     public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
23 23
     {
24 24
         $type = $property->getType();
25
-        if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) {
26
-            foreach ($this->registry->getCasters() as $setter) {
27
-                if ($setter->supports($type)) {
25
+        if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()){
26
+            foreach ($this->registry->getCasters() as $setter){
27
+                if ($setter->supports($type)){
28 28
                     $setter->setValue($filter, $property, $value);
29 29
                     return;
30 30
                 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,12 @@
 block discarded – undo
22 22
     public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
23 23
     {
24 24
         $type = $property->getType();
25
-        if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) {
26
-            foreach ($this->registry->getCasters() as $setter) {
27
-                if ($setter->supports($type)) {
25
+        if ($type instanceof \ReflectionNamedType && !$type->isBuiltin())
26
+        {
27
+            foreach ($this->registry->getCasters() as $setter)
28
+            {
29
+                if ($setter->supports($type))
30
+                {
28 31
                     $setter->setValue($filter, $property, $value);
29 32
                     return;
30 33
                 }
Please login to merge, or discard this patch.
src/Filters/src/Attribute/Setter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 
32 32
     public function updateValue(mixed $value): mixed
33 33
     {
34
-        try {
34
+        try{
35 35
             return ($this->filter)($value, ...$this->args);
36
-        } catch (\Throwable $e) {
36
+        }catch (\Throwable $e){
37 37
             throw new SetterException($e);
38 38
         }
39 39
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,12 @@
 block discarded – undo
31 31
 
32 32
     public function updateValue(mixed $value): mixed
33 33
     {
34
-        try {
34
+        try
35
+        {
35 36
             return ($this->filter)($value, ...$this->args);
36
-        } catch (\Throwable $e) {
37
+        }
38
+        catch (\Throwable $e)
39
+        {
37 40
             throw new SetterException($e);
38 41
         }
39 42
     }
Please login to merge, or discard this patch.
src/Filters/src/Model/Interceptor/ValidateFilterInterceptor.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 {
24 24
     public function __construct(
25 25
         private readonly ContainerInterface $container
26
-    ) {
26
+    ){
27 27
     }
28 28
 
29 29
     /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $bag = $parameters['filterBag'];
35 35
         $filter = $core->callAction($controller, $action, $parameters);
36 36
 
37
-        if ($filter instanceof HasFilterDefinition) {
37
+        if ($filter instanceof HasFilterDefinition){
38 38
             $this->validateFilter(
39 39
                 $filter->filterDefinition(),
40 40
                 $bag,
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             );
44 44
         }
45 45
 
46
-        if (($bag->errors ?? []) !== []) {
46
+        if (($bag->errors ?? []) !== []){
47 47
             $errorMapper = new ErrorMapper($bag->schema);
48 48
             throw new ValidationException($errorMapper->mapErrors($bag->errors), $parameters['context'] ?? null);
49 49
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         array $errors,
58 58
         mixed $context
59 59
     ): void {
60
-        if ($definition instanceof ShouldBeValidated) {
60
+        if ($definition instanceof ShouldBeValidated){
61 61
             $errorMapper = new ErrorMapper($bag->schema);
62 62
             $validationProvider = $this->container->get(ValidationProviderInterface::class);
63 63
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
                 ->getValidation($definition::class)
66 66
                 ->validate($bag, $definition->validationRules(), $context);
67 67
 
68
-            if (!$validator->isValid()) {
68
+            if (!$validator->isValid()){
69 69
                 throw new ValidationException(
70 70
                     $errorMapper->mapErrors(\array_merge($errors, $validator->getErrors())),
71 71
                     $context
72 72
                 );
73
-            } elseif ($errors !== []) {
73
+            } elseif ($errors !== []){
74 74
                 throw new ValidationException($errorMapper->mapErrors($errors), $context);
75 75
             }
76 76
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
         $bag = $parameters['filterBag'];
35 35
         $filter = $core->callAction($controller, $action, $parameters);
36 36
 
37
-        if ($filter instanceof HasFilterDefinition) {
37
+        if ($filter instanceof HasFilterDefinition)
38
+        {
38 39
             $this->validateFilter(
39 40
                 $filter->filterDefinition(),
40 41
                 $bag,
@@ -43,7 +44,8 @@  discard block
 block discarded – undo
43 44
             );
44 45
         }
45 46
 
46
-        if (($bag->errors ?? []) !== []) {
47
+        if (($bag->errors ?? []) !== [])
48
+        {
47 49
             $errorMapper = new ErrorMapper($bag->schema);
48 50
             throw new ValidationException($errorMapper->mapErrors($bag->errors), $parameters['context'] ?? null);
49 51
         }
@@ -57,7 +59,8 @@  discard block
 block discarded – undo
57 59
         array $errors,
58 60
         mixed $context
59 61
     ): void {
60
-        if ($definition instanceof ShouldBeValidated) {
62
+        if ($definition instanceof ShouldBeValidated)
63
+        {
61 64
             $errorMapper = new ErrorMapper($bag->schema);
62 65
             $validationProvider = $this->container->get(ValidationProviderInterface::class);
63 66
 
@@ -65,12 +68,15 @@  discard block
 block discarded – undo
65 68
                 ->getValidation($definition::class)
66 69
                 ->validate($bag, $definition->validationRules(), $context);
67 70
 
68
-            if (!$validator->isValid()) {
71
+            if (!$validator->isValid())
72
+            {
69 73
                 throw new ValidationException(
70 74
                     $errorMapper->mapErrors(\array_merge($errors, $validator->getErrors())),
71 75
                     $context
72 76
                 );
73
-            } elseif ($errors !== []) {
77
+            }
78
+            elseif ($errors !== [])
79
+            {
74 80
                 throw new ValidationException($errorMapper->mapErrors($errors), $context);
75 81
             }
76 82
         }
Please login to merge, or discard this patch.
src/Filters/src/Model/Schema/InputMapper.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct(
16 16
         private readonly FilterProviderInterface $provider
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function map(array $mappingSchema, InputInterface $input, array $setters = []): array
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
         $errors = [];
23 23
         $result = [];
24 24
 
25
-        foreach ($mappingSchema as $field => $map) {
26
-            if (empty($map[Builder::SCHEMA_FILTER])) {
25
+        foreach ($mappingSchema as $field => $map){
26
+            if (empty($map[Builder::SCHEMA_FILTER])){
27 27
                 $value = $input->getValue($map[Builder::SCHEMA_SOURCE], $map[Builder::SCHEMA_ORIGIN]);
28 28
 
29
-                if ($value !== null) {
29
+                if ($value !== null){
30 30
                     /** @var Setter $setter */
31
-                    foreach ($setters[$field] ?? [] as $setter) {
32
-                        try {
31
+                    foreach ($setters[$field] ?? [] as $setter){
32
+                        try{
33 33
                             $value = $setter->updateValue($value);
34
-                        } catch (SetterException $e) {
34
+                        }catch (SetterException $e){
35 35
                             $errors[$field] = $e->getMessage();
36 36
                         }
37 37
                     }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
             }
43 43
 
44 44
             $nested = $map[Builder::SCHEMA_FILTER];
45
-            if (empty($map[Builder::SCHEMA_ARRAY])) {
45
+            if (empty($map[Builder::SCHEMA_ARRAY])){
46 46
                 // slicing down
47
-                try {
47
+                try{
48 48
                     $result[$field] = $this->provider->createFilter($nested, $input->withPrefix($map[Builder::SCHEMA_ORIGIN]));
49
-                } catch (ValidationException $e) {
50
-                    if ($map[Builder::SCHEMA_OPTIONAL]) {
49
+                }catch (ValidationException $e){
50
+                    if ($map[Builder::SCHEMA_OPTIONAL]){
51 51
                         $result[$field] = null;
52 52
                         continue;
53 53
                     }
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
             $values = [];
60 60
 
61 61
             // List of "key" => "location in request"
62
-            foreach ($this->iterate($map, $input) as $index => $origin) {
63
-                try {
62
+            foreach ($this->iterate($map, $input) as $index => $origin){
63
+                try{
64 64
                     $values[$index] = $this->provider->createFilter($nested, $input->withPrefix($origin));
65
-                } catch (ValidationException $e) {
65
+                }catch (ValidationException $e){
66 66
                     $errors[$field][$index] = $e->errors;
67 67
                 }
68 68
             }
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
             $schema[Builder::SCHEMA_ITERATE_ORIGIN]
84 84
         );
85 85
 
86
-        if (empty($values) || !\is_array($values)) {
86
+        if (empty($values) || !\is_array($values)){
87 87
             return [];
88 88
         }
89 89
 
90
-        foreach (\array_keys($values) as $key) {
91
-            yield $key => $schema[Builder::SCHEMA_ORIGIN] . '.' . $key;
90
+        foreach (\array_keys($values) as $key){
91
+            yield $key => $schema[Builder::SCHEMA_ORIGIN].'.'.$key;
92 92
         }
93 93
     }
94 94
 }
Please login to merge, or discard this patch.
Braces   +33 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,16 +22,23 @@  discard block
 block discarded – undo
22 22
         $errors = [];
23 23
         $result = [];
24 24
 
25
-        foreach ($mappingSchema as $field => $map) {
26
-            if (empty($map[Builder::SCHEMA_FILTER])) {
25
+        foreach ($mappingSchema as $field => $map)
26
+        {
27
+            if (empty($map[Builder::SCHEMA_FILTER]))
28
+            {
27 29
                 $value = $input->getValue($map[Builder::SCHEMA_SOURCE], $map[Builder::SCHEMA_ORIGIN]);
28 30
 
29
-                if ($value !== null) {
31
+                if ($value !== null)
32
+                {
30 33
                     /** @var Setter $setter */
31
-                    foreach ($setters[$field] ?? [] as $setter) {
32
-                        try {
34
+                    foreach ($setters[$field] ?? [] as $setter)
35
+                    {
36
+                        try
37
+                        {
33 38
                             $value = $setter->updateValue($value);
34
-                        } catch (SetterException $e) {
39
+                        }
40
+                        catch (SetterException $e)
41
+                        {
35 42
                             $errors[$field] = $e->getMessage();
36 43
                         }
37 44
                     }
@@ -42,12 +49,17 @@  discard block
 block discarded – undo
42 49
             }
43 50
 
44 51
             $nested = $map[Builder::SCHEMA_FILTER];
45
-            if (empty($map[Builder::SCHEMA_ARRAY])) {
52
+            if (empty($map[Builder::SCHEMA_ARRAY]))
53
+            {
46 54
                 // slicing down
47
-                try {
55
+                try
56
+                {
48 57
                     $result[$field] = $this->provider->createFilter($nested, $input->withPrefix($map[Builder::SCHEMA_ORIGIN]));
49
-                } catch (ValidationException $e) {
50
-                    if ($map[Builder::SCHEMA_OPTIONAL]) {
58
+                }
59
+                catch (ValidationException $e)
60
+                {
61
+                    if ($map[Builder::SCHEMA_OPTIONAL])
62
+                    {
51 63
                         $result[$field] = null;
52 64
                         continue;
53 65
                     }
@@ -59,10 +71,14 @@  discard block
 block discarded – undo
59 71
             $values = [];
60 72
 
61 73
             // List of "key" => "location in request"
62
-            foreach ($this->iterate($map, $input) as $index => $origin) {
63
-                try {
74
+            foreach ($this->iterate($map, $input) as $index => $origin)
75
+            {
76
+                try
77
+                {
64 78
                     $values[$index] = $this->provider->createFilter($nested, $input->withPrefix($origin));
65
-                } catch (ValidationException $e) {
79
+                }
80
+                catch (ValidationException $e)
81
+                {
66 82
                     $errors[$field][$index] = $e->errors;
67 83
                 }
68 84
             }
@@ -83,11 +99,13 @@  discard block
 block discarded – undo
83 99
             $schema[Builder::SCHEMA_ITERATE_ORIGIN]
84 100
         );
85 101
 
86
-        if (empty($values) || !\is_array($values)) {
102
+        if (empty($values) || !\is_array($values))
103
+        {
87 104
             return [];
88 105
         }
89 106
 
90
-        foreach (\array_keys($values) as $key) {
107
+        foreach (\array_keys($values) as $key)
108
+        {
91 109
             yield $key => $schema[Builder::SCHEMA_ORIGIN] . '.' . $key;
92 110
         }
93 111
     }
Please login to merge, or discard this patch.
src/Queue/tests/Driver/SyncDriverTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
 final class SyncDriverTest extends TestCase
22 22
 {
23 23
     private SyncDriver $queue;
24
-    private m\LegacyMockInterface|m\MockInterface|CoreInterface $core;
25
-    private m\LegacyMockInterface|m\MockInterface|UuidFactoryInterface $factory;
24
+    private m\LegacyMockInterface | m\MockInterface | CoreInterface $core;
25
+    private m\LegacyMockInterface | m\MockInterface | UuidFactoryInterface $factory;
26 26
     private UuidFactoryInterface $realfactory;
27 27
 
28 28
     protected function setUp(): void
Please login to merge, or discard this patch.
src/Framework/Bootloader/Attributes/AttributesBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct(
32 32
         private readonly ConfiguratorInterface $config,
33
-    ) {
33
+    ){
34 34
     }
35 35
 
36 36
     public function init(EnvironmentInterface $env): void
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     private function initInstantiator(AttributesConfig $config): InstantiatorInterface
53 53
     {
54
-        if ($config->isAnnotationsReaderEnabled()) {
54
+        if ($config->isAnnotationsReaderEnabled()){
55 55
             return new Facade();
56 56
         }
57 57
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     ): ReaderInterface {
67 67
         $reader = new AttributeReader($instantiator);
68 68
 
69
-        if ($config->isCacheEnabled()) {
69
+        if ($config->isCacheEnabled()){
70 70
             $provider = $container->get(CacheStorageProviderInterface::class);
71 71
             \assert($provider instanceof CacheStorageProviderInterface);
72 72
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
         $supportAnnotations = $config->isAnnotationsReaderEnabled();
77 77
 
78
-        if ($supportAnnotations) {
79
-            if (!\interface_exists(DoctrineReaderInterface::class)) {
78
+        if ($supportAnnotations){
79
+            if (!\interface_exists(DoctrineReaderInterface::class)){
80 80
                 throw new InitializationException(
81 81
                     'Doctrine annotations reader is not available, please install "doctrine/annotations" package',
82 82
                 );
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
     private function initInstantiator(AttributesConfig $config): InstantiatorInterface
53 53
     {
54
-        if ($config->isAnnotationsReaderEnabled()) {
54
+        if ($config->isAnnotationsReaderEnabled())
55
+        {
55 56
             return new Facade();
56 57
         }
57 58
 
@@ -66,7 +67,8 @@  discard block
 block discarded – undo
66 67
     ): ReaderInterface {
67 68
         $reader = new AttributeReader($instantiator);
68 69
 
69
-        if ($config->isCacheEnabled()) {
70
+        if ($config->isCacheEnabled())
71
+        {
70 72
             $provider = $container->get(CacheStorageProviderInterface::class);
71 73
             \assert($provider instanceof CacheStorageProviderInterface);
72 74
 
@@ -75,8 +77,10 @@  discard block
 block discarded – undo
75 77
 
76 78
         $supportAnnotations = $config->isAnnotationsReaderEnabled();
77 79
 
78
-        if ($supportAnnotations) {
79
-            if (!\interface_exists(DoctrineReaderInterface::class)) {
80
+        if ($supportAnnotations)
81
+        {
82
+            if (!\interface_exists(DoctrineReaderInterface::class))
83
+            {
80 84
                 throw new InitializationException(
81 85
                     'Doctrine annotations reader is not available, please install "doctrine/annotations" package',
82 86
                 );
Please login to merge, or discard this patch.
src/Queue/tests/Exception/TestRetryException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     public function __construct(
13 13
         private readonly bool $retryable = true,
14 14
         private readonly ?RetryPolicyInterface $retryPolicy = null
15
-    ) {
15
+    ){
16 16
     }
17 17
 
18 18
     public function isRetryable(): bool
Please login to merge, or discard this patch.
src/Queue/src/RetryPolicy.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct(int $maxAttempts, int $delay, float $multiplier = 1)
32 32
     {
33
-        if ($maxAttempts < 0) {
33
+        if ($maxAttempts < 0){
34 34
             throw new InvalidArgumentException(
35 35
                 \sprintf('Maximum attempts must be greater than or equal to zero: `%s` given.', $maxAttempts)
36 36
             );
37 37
         }
38 38
         $this->maxAttempts = $maxAttempts;
39 39
 
40
-        if ($delay < 0) {
40
+        if ($delay < 0){
41 41
             throw new InvalidArgumentException(
42 42
                 \sprintf('Delay must be greater than or equal to zero: `%s` given.', $delay)
43 43
             );
44 44
         }
45 45
         $this->delay = $delay;
46 46
 
47
-        if ($multiplier < 1) {
47
+        if ($multiplier < 1){
48 48
             throw new InvalidArgumentException(
49 49
                 \sprintf('Multiplier must be greater than zero: `%s` given.', $multiplier)
50 50
             );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function getDelay(int $attempts = 0): int
61 61
     {
62
-        return (int) \ceil($this->delay * $this->multiplier ** $attempts);
62
+        return (int)\ceil($this->delay * $this->multiplier ** $attempts);
63 63
     }
64 64
 
65 65
     /**
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function isRetryable(\Throwable $exception, int $attempts = 0): bool
69 69
     {
70
-        if ($exception instanceof JobException && $exception->getPrevious() !== null) {
70
+        if ($exception instanceof JobException && $exception->getPrevious() !== null){
71 71
             $exception = $exception->getPrevious();
72 72
         }
73 73
 
74
-        if (!$exception instanceof RetryableExceptionInterface || $this->maxAttempts === 0) {
74
+        if (!$exception instanceof RetryableExceptionInterface || $this->maxAttempts === 0){
75 75
             return false;
76 76
         }
77 77
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,21 +30,24 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct(int $maxAttempts, int $delay, float $multiplier = 1)
32 32
     {
33
-        if ($maxAttempts < 0) {
33
+        if ($maxAttempts < 0)
34
+        {
34 35
             throw new InvalidArgumentException(
35 36
                 \sprintf('Maximum attempts must be greater than or equal to zero: `%s` given.', $maxAttempts)
36 37
             );
37 38
         }
38 39
         $this->maxAttempts = $maxAttempts;
39 40
 
40
-        if ($delay < 0) {
41
+        if ($delay < 0)
42
+        {
41 43
             throw new InvalidArgumentException(
42 44
                 \sprintf('Delay must be greater than or equal to zero: `%s` given.', $delay)
43 45
             );
44 46
         }
45 47
         $this->delay = $delay;
46 48
 
47
-        if ($multiplier < 1) {
49
+        if ($multiplier < 1)
50
+        {
48 51
             throw new InvalidArgumentException(
49 52
                 \sprintf('Multiplier must be greater than zero: `%s` given.', $multiplier)
50 53
             );
@@ -67,11 +70,13 @@  discard block
 block discarded – undo
67 70
      */
68 71
     public function isRetryable(\Throwable $exception, int $attempts = 0): bool
69 72
     {
70
-        if ($exception instanceof JobException && $exception->getPrevious() !== null) {
73
+        if ($exception instanceof JobException && $exception->getPrevious() !== null)
74
+        {
71 75
             $exception = $exception->getPrevious();
72 76
         }
73 77
 
74
-        if (!$exception instanceof RetryableExceptionInterface || $this->maxAttempts === 0) {
78
+        if (!$exception instanceof RetryableExceptionInterface || $this->maxAttempts === 0)
79
+        {
75 80
             return false;
76 81
         }
77 82
 
Please login to merge, or discard this patch.
src/Queue/src/Attribute/RetryPolicy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         protected readonly int $maxAttempts = 3,
33 33
         protected readonly int $delay = 1,
34 34
         protected readonly float $multiplier = 1
35
-    ) {
35
+    ){
36 36
     }
37 37
 
38 38
     public function getRetryPolicy(): RetryPolicyInterface
Please login to merge, or discard this patch.