Test Failed
Pull Request — master (#1190)
by butschster
10:27
created
src/Prototype/src/Command/DumpCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function perform(Writer $writer): int
24 24
     {
25 25
         $dependencies = $this->getRegistry()->getPropertyBindings();
26
-        if ($dependencies === []) {
26
+        if ($dependencies === []){
27 27
             $this->comment('No prototyped shortcuts found.');
28 28
 
29 29
             return self::SUCCESS;
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
         $file = FileDeclaration::fromReflection($ref);
36 36
         $trait = $file->getTrait(PrototypeTrait::class);
37 37
 
38
-        try {
38
+        try{
39 39
             $this->buildAnnotation($trait, $dependencies);
40 40
 
41 41
             $writer->write($ref->getFileName(), $file);
42
-        } catch (\Throwable $e) {
43
-            $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n");
42
+        }catch (\Throwable $e){
43
+            $this->write('<fg=red>'.$e->getMessage()."</fg=red>\n");
44 44
 
45 45
             return self::FAILURE;
46 46
         }
47 47
 
48 48
         $this->write("<fg=green>complete</fg=green>\n");
49 49
 
50
-        if ($this->isVerbose()) {
50
+        if ($this->isVerbose()){
51 51
             $grid = $this->table(['Property:', 'Target:']);
52 52
 
53
-            foreach ($dependencies as $dependency) {
53
+            foreach ($dependencies as $dependency){
54 54
                 $grid->addRow([$dependency->var, $dependency->type->fullName]);
55 55
             }
56 56
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $trait->addComment('This DocComment is auto-generated, do not edit or commit this file to repository.');
67 67
         $trait->addComment('');
68 68
 
69
-        foreach ($dependencies as $dependency) {
69
+        foreach ($dependencies as $dependency){
70 70
             $trait->addComment(\sprintf('@property \\%s $%s', $dependency->type->fullName, $dependency->var));
71 71
         }
72 72
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
     public function perform(Writer $writer): int
24 24
     {
25 25
         $dependencies = $this->getRegistry()->getPropertyBindings();
26
-        if ($dependencies === []) {
26
+        if ($dependencies === [])
27
+        {
27 28
             $this->comment('No prototyped shortcuts found.');
28 29
 
29 30
             return self::SUCCESS;
@@ -35,11 +36,14 @@  discard block
 block discarded – undo
35 36
         $file = FileDeclaration::fromReflection($ref);
36 37
         $trait = $file->getTrait(PrototypeTrait::class);
37 38
 
38
-        try {
39
+        try
40
+        {
39 41
             $this->buildAnnotation($trait, $dependencies);
40 42
 
41 43
             $writer->write($ref->getFileName(), $file);
42
-        } catch (\Throwable $e) {
44
+        }
45
+        catch (\Throwable $e)
46
+        {
43 47
             $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n");
44 48
 
45 49
             return self::FAILURE;
@@ -47,10 +51,12 @@  discard block
 block discarded – undo
47 51
 
48 52
         $this->write("<fg=green>complete</fg=green>\n");
49 53
 
50
-        if ($this->isVerbose()) {
54
+        if ($this->isVerbose())
55
+        {
51 56
             $grid = $this->table(['Property:', 'Target:']);
52 57
 
53
-            foreach ($dependencies as $dependency) {
58
+            foreach ($dependencies as $dependency)
59
+            {
54 60
                 $grid->addRow([$dependency->var, $dependency->type->fullName]);
55 61
             }
56 62
 
@@ -66,7 +72,8 @@  discard block
 block discarded – undo
66 72
         $trait->addComment('This DocComment is auto-generated, do not edit or commit this file to repository.');
67 73
         $trait->addComment('');
68 74
 
69
-        foreach ($dependencies as $dependency) {
75
+        foreach ($dependencies as $dependency)
76
+        {
70 77
             $trait->addComment(\sprintf('@property \\%s $%s', $dependency->type->fullName, $dependency->var));
71 78
         }
72 79
     }
Please login to merge, or discard this patch.
src/Boot/src/Bootloader/BootloaderRegistryInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      *  1. SimpleBootloader::class,
17 17
      *  2. [SimpleBootloader::class => ['option' => 'value']]
18 18
      */
19
-    public function registerSystem(string|array $bootloader): void;
19
+    public function registerSystem(string | array $bootloader): void;
20 20
 
21 21
     /**
22 22
      * @param TClass|array<TClass, array<string, mixed>> $bootloader
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *  1. SimpleBootloader::class,
26 26
      *  2. [SimpleBootloader::class => ['option' => 'value']]
27 27
      */
28
-    public function register(string|array $bootloader): void;
28
+    public function register(string | array $bootloader): void;
29 29
 
30 30
     /**
31 31
      * @return array<TClass>|array<TClass, array<string, mixed>>
Please login to merge, or discard this patch.
src/Boot/src/Bootloader/BootloaderRegistry.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private array $systemBootloaders = [],
18 18
         private array $bootloaders = [],
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     /**
23 23
      * @param TClass|array<TClass, array<string, mixed>> $bootloader
24 24
      */
25
-    public function registerSystem(string|array $bootloader): void
25
+    public function registerSystem(string | array $bootloader): void
26 26
     {
27
-        if ($this->hasBootloader($bootloader)) {
27
+        if ($this->hasBootloader($bootloader)){
28 28
             return;
29 29
         }
30 30
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * @param TClass|array<TClass, array<string, mixed>> $bootloader
39 39
      */
40
-    public function register(string|array $bootloader): void
40
+    public function register(string | array $bootloader): void
41 41
     {
42
-        if ($this->hasBootloader($bootloader)) {
42
+        if ($this->hasBootloader($bootloader)){
43 43
             return;
44 44
         }
45 45
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     /**
69 69
      * @param TClass|array<TClass, array<string, mixed>> $bootloader
70 70
      */
71
-    private function hasBootloader(string|array $bootloader): bool
71
+    private function hasBootloader(string | array $bootloader): bool
72 72
     {
73
-        if (\is_array($bootloader)) {
73
+        if (\is_array($bootloader)){
74 74
             return false;
75 75
         }
76 76
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function registerSystem(string|array $bootloader): void
26 26
     {
27
-        if ($this->hasBootloader($bootloader)) {
27
+        if ($this->hasBootloader($bootloader))
28
+        {
28 29
             return;
29 30
         }
30 31
 
@@ -39,7 +40,8 @@  discard block
 block discarded – undo
39 40
      */
40 41
     public function register(string|array $bootloader): void
41 42
     {
42
-        if ($this->hasBootloader($bootloader)) {
43
+        if ($this->hasBootloader($bootloader))
44
+        {
43 45
             return;
44 46
         }
45 47
 
@@ -70,7 +72,8 @@  discard block
 block discarded – undo
70 72
      */
71 73
     private function hasBootloader(string|array $bootloader): bool
72 74
     {
73
-        if (\is_array($bootloader)) {
75
+        if (\is_array($bootloader))
76
+        {
74 77
             return false;
75 78
         }
76 79
 
Please login to merge, or discard this patch.
src/Filters/src/Attribute/CastingErrorMessage.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@
 block discarded – undo
15 15
     public function __construct(
16 16
         protected ?string $message = null,
17 17
         ?callable $callback = null
18
-    ) {
19
-        if ($callback !== null) {
18
+    ){
19
+        if ($callback !== null){
20 20
             $this->callback = $callback(...);
21 21
         }
22 22
     }
23 23
 
24 24
     public function getMessage(SetterException $exception, mixed $value = null): ?string
25 25
     {
26
-        if ($this->callback instanceof \Closure) {
26
+        if ($this->callback instanceof \Closure){
27 27
             return ($this->callback)($exception, $value);
28 28
         }
29 29
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,14 +16,16 @@
 block discarded – undo
16 16
         protected ?string $message = null,
17 17
         ?callable $callback = null
18 18
     ) {
19
-        if ($callback !== null) {
19
+        if ($callback !== null)
20
+        {
20 21
             $this->callback = $callback(...);
21 22
         }
22 23
     }
23 24
 
24 25
     public function getMessage(SetterException $exception, mixed $value = null): ?string
25 26
     {
26
-        if ($this->callback instanceof \Closure) {
27
+        if ($this->callback instanceof \Closure)
28
+        {
27 29
             return ($this->callback)($exception, $value);
28 30
         }
29 31
 
Please login to merge, or discard this patch.
src/Filters/src/Model/Mapper/EnumCaster.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
          */
27 27
         $enum = $type->getName();
28 28
 
29
-        try {
29
+        try{
30 30
             $property->setValue($filter, $value instanceof $enum ? $value : $enum::from($value));
31
-        } catch (\Throwable $e) {
31
+        }catch (\Throwable $e){
32 32
             throw new SetterException(
33 33
                 previous: $e,
34 34
                 message: \sprintf('Unable to set enum value. %s', $e->getMessage()),
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,12 @@
 block discarded – undo
26 26
          */
27 27
         $enum = $type->getName();
28 28
 
29
-        try {
29
+        try
30
+        {
30 31
             $property->setValue($filter, $value instanceof $enum ? $value : $enum::from($value));
31
-        } catch (\Throwable $e) {
32
+        }
33
+        catch (\Throwable $e)
34
+        {
32 35
             throw new SetterException(
33 36
                 previous: $e,
34 37
                 message: \sprintf('Unable to set enum value. %s', $e->getMessage()),
Please login to merge, or discard this patch.
src/Filters/src/Model/Mapper/DefaultCaster.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 
17 17
     public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
18 18
     {
19
-        try {
19
+        try{
20 20
             $property->setValue($filter, $value);
21
-        } catch (\Throwable $e) {
21
+        }catch (\Throwable $e){
22 22
             throw new SetterException(
23 23
                 previous: $e,
24 24
                 message: \sprintf('Unable to set value. %s', $e->getMessage()),
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,9 +16,12 @@
 block discarded – undo
16 16
 
17 17
     public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
18 18
     {
19
-        try {
19
+        try
20
+        {
20 21
             $property->setValue($filter, $value);
21
-        } catch (\Throwable $e) {
22
+        }
23
+        catch (\Throwable $e)
24
+        {
22 25
             throw new SetterException(
23 26
                 previous: $e,
24 27
                 message: \sprintf('Unable to set value. %s', $e->getMessage()),
Please login to merge, or discard this patch.
src/Filters/src/Model/Schema/AttributeMapper.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         private readonly FilterProviderInterface $provider,
27 27
         private readonly ReaderInterface $reader,
28 28
         private readonly Mapper $mapper
29
-    ) {
29
+    ){
30 30
     }
31 31
 
32 32
     /**
@@ -40,54 +40,54 @@  discard block
 block discarded – undo
40 40
         $optionalFilters = [];
41 41
         $class = new \ReflectionClass($filter);
42 42
 
43
-        foreach ($class->getProperties() as $property) {
43
+        foreach ($class->getProperties() as $property){
44 44
             /** @var object $attribute */
45
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
46
-                if ($attribute instanceof AbstractInput) {
45
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute){
46
+                if ($attribute instanceof AbstractInput){
47 47
                     $value = $attribute->getValue($input, $property);
48
-                    try {
48
+                    try{
49 49
                         $this->setValue($filter, $property, $value);
50
-                    } catch (SetterException $e) {
50
+                    }catch (SetterException $e){
51 51
                         $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
52 52
                     }
53 53
                     $schema[$property->getName()] = $attribute->getSchema($property);
54
-                } elseif ($attribute instanceof NestedFilter) {
54
+                } elseif ($attribute instanceof NestedFilter){
55 55
                     $prefix = $attribute->prefix ?? $property->name;
56
-                    try {
56
+                    try{
57 57
                         $value = $this->provider->createFilter(
58 58
                             $attribute->class,
59 59
                             $input->withPrefix($prefix)
60 60
                         );
61 61
 
62
-                        try {
62
+                        try{
63 63
                             $this->setValue($filter, $property, $value);
64
-                        } catch (SetterException $e) {
64
+                        }catch (SetterException $e){
65 65
                             $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
66 66
                         }
67
-                    } catch (ValidationException $e) {
68
-                        if ($this->allowsNull($property)) {
67
+                    }catch (ValidationException $e){
68
+                        if ($this->allowsNull($property)){
69 69
                             $this->setValue($filter, $property, null);
70 70
                             $optionalFilters[] = $property->getName();
71
-                        } else {
71
+                        }else{
72 72
                             $errors[$prefix] = $e->errors;
73 73
                         }
74 74
                     }
75 75
 
76 76
                     $schema[$property->getName()] = $attribute->getSchema($property);
77
-                } elseif ($attribute instanceof NestedArray) {
77
+                } elseif ($attribute instanceof NestedArray){
78 78
                     $values = $attribute->getValue($input, $property);
79 79
                     $propertyValues = [];
80 80
 
81 81
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
82 82
 
83
-                    if (\is_array($values)) {
84
-                        foreach (\array_keys($values) as $key) {
85
-                            try {
83
+                    if (\is_array($values)){
84
+                        foreach (\array_keys($values) as $key){
85
+                            try{
86 86
                                 $propertyValues[$key] = $this->provider->createFilter(
87 87
                                     $attribute->class,
88
-                                    $input->withPrefix($prefix . '.' . $key)
88
+                                    $input->withPrefix($prefix.'.'.$key)
89 89
                                 );
90
-                            } catch (ValidationException $e) {
90
+                            }catch (ValidationException $e){
91 91
                                 /** @psalm-suppress InvalidArrayOffset */
92 92
                                 $errors[$property->getName()][$key] = $e->errors;
93 93
                             }
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
                     }
96 96
 
97 97
                     $this->setValue($filter, $property, $propertyValues);
98
-                    $schema[$property->getName()] = [$attribute->class, $prefix . '.*'];
99
-                } elseif ($attribute instanceof Setter) {
98
+                    $schema[$property->getName()] = [$attribute->class, $prefix.'.*'];
99
+                } elseif ($attribute instanceof Setter){
100 100
                     $setters[$property->getName()][] = $attribute;
101 101
                 }
102 102
             }
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 
108 108
     private function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
109 109
     {
110
-        if ($value === null) {
110
+        if ($value === null){
111 111
             return;
112 112
         }
113 113
 
114 114
         $setters = $this->reader->getPropertyMetadata($property, Setter::class);
115 115
 
116
-        foreach ($setters as $setter) {
116
+        foreach ($setters as $setter){
117 117
             $value = $setter->updateValue($value);
118 118
         }
119 119
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     ): string {
135 135
         $attribute = $this->reader->firstPropertyMetadata($property, CastingErrorMessage::class);
136 136
 
137
-        if ($attribute === null) {
137
+        if ($attribute === null){
138 138
             return $exception->getMessage();
139 139
         }
140 140
 
Please login to merge, or discard this patch.
Braces   +50 added lines, -21 removed lines patch added patch discarded remove patch
@@ -40,54 +40,78 @@  discard block
 block discarded – undo
40 40
         $optionalFilters = [];
41 41
         $class = new \ReflectionClass($filter);
42 42
 
43
-        foreach ($class->getProperties() as $property) {
43
+        foreach ($class->getProperties() as $property)
44
+        {
44 45
             /** @var object $attribute */
45
-            foreach ($this->reader->getPropertyMetadata($property) as $attribute) {
46
-                if ($attribute instanceof AbstractInput) {
46
+            foreach ($this->reader->getPropertyMetadata($property) as $attribute)
47
+            {
48
+                if ($attribute instanceof AbstractInput)
49
+                {
47 50
                     $value = $attribute->getValue($input, $property);
48
-                    try {
51
+                    try
52
+                    {
49 53
                         $this->setValue($filter, $property, $value);
50
-                    } catch (SetterException $e) {
54
+                    }
55
+                    catch (SetterException $e)
56
+                    {
51 57
                         $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
52 58
                     }
53 59
                     $schema[$property->getName()] = $attribute->getSchema($property);
54
-                } elseif ($attribute instanceof NestedFilter) {
60
+                }
61
+                elseif ($attribute instanceof NestedFilter)
62
+                {
55 63
                     $prefix = $attribute->prefix ?? $property->name;
56
-                    try {
64
+                    try
65
+                    {
57 66
                         $value = $this->provider->createFilter(
58 67
                             $attribute->class,
59 68
                             $input->withPrefix($prefix)
60 69
                         );
61 70
 
62
-                        try {
71
+                        try
72
+                        {
63 73
                             $this->setValue($filter, $property, $value);
64
-                        } catch (SetterException $e) {
74
+                        }
75
+                        catch (SetterException $e)
76
+                        {
65 77
                             $errors[$property->getName()] = $this->createErrorMessage($e, $property, $value);
66 78
                         }
67
-                    } catch (ValidationException $e) {
68
-                        if ($this->allowsNull($property)) {
79
+                    }
80
+                    catch (ValidationException $e)
81
+                    {
82
+                        if ($this->allowsNull($property))
83
+                        {
69 84
                             $this->setValue($filter, $property, null);
70 85
                             $optionalFilters[] = $property->getName();
71
-                        } else {
86
+                        }
87
+                        else
88
+                        {
72 89
                             $errors[$prefix] = $e->errors;
73 90
                         }
74 91
                     }
75 92
 
76 93
                     $schema[$property->getName()] = $attribute->getSchema($property);
77
-                } elseif ($attribute instanceof NestedArray) {
94
+                }
95
+                elseif ($attribute instanceof NestedArray)
96
+                {
78 97
                     $values = $attribute->getValue($input, $property);
79 98
                     $propertyValues = [];
80 99
 
81 100
                     $prefix = $attribute->input->key ?? $attribute->prefix ?? $property->getName();
82 101
 
83
-                    if (\is_array($values)) {
84
-                        foreach (\array_keys($values) as $key) {
85
-                            try {
102
+                    if (\is_array($values))
103
+                    {
104
+                        foreach (\array_keys($values) as $key)
105
+                        {
106
+                            try
107
+                            {
86 108
                                 $propertyValues[$key] = $this->provider->createFilter(
87 109
                                     $attribute->class,
88 110
                                     $input->withPrefix($prefix . '.' . $key)
89 111
                                 );
90
-                            } catch (ValidationException $e) {
112
+                            }
113
+                            catch (ValidationException $e)
114
+                            {
91 115
                                 /** @psalm-suppress InvalidArrayOffset */
92 116
                                 $errors[$property->getName()][$key] = $e->errors;
93 117
                             }
@@ -96,7 +120,9 @@  discard block
 block discarded – undo
96 120
 
97 121
                     $this->setValue($filter, $property, $propertyValues);
98 122
                     $schema[$property->getName()] = [$attribute->class, $prefix . '.*'];
99
-                } elseif ($attribute instanceof Setter) {
123
+                }
124
+                elseif ($attribute instanceof Setter)
125
+                {
100 126
                     $setters[$property->getName()][] = $attribute;
101 127
                 }
102 128
             }
@@ -107,13 +133,15 @@  discard block
 block discarded – undo
107 133
 
108 134
     private function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void
109 135
     {
110
-        if ($value === null) {
136
+        if ($value === null)
137
+        {
111 138
             return;
112 139
         }
113 140
 
114 141
         $setters = $this->reader->getPropertyMetadata($property, Setter::class);
115 142
 
116
-        foreach ($setters as $setter) {
143
+        foreach ($setters as $setter)
144
+        {
117 145
             $value = $setter->updateValue($value);
118 146
         }
119 147
 
@@ -134,7 +162,8 @@  discard block
 block discarded – undo
134 162
     ): string {
135 163
         $attribute = $this->reader->firstPropertyMetadata($property, CastingErrorMessage::class);
136 164
 
137
-        if ($attribute === null) {
165
+        if ($attribute === null)
166
+        {
138 167
             return $exception->getMessage();
139 168
         }
140 169
 
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/Attribute/TargetWorker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 #[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor]
11 11
 final class TargetWorker extends BootloadConfig
12 12
 {
13
-    public function __construct(array|string $workers)
13
+    public function __construct(array | string $workers)
14 14
     {
15 15
         parent::__construct(allowEnv: ['RR_MODE' => $workers]);
16 16
     }
Please login to merge, or discard this patch.
src/Boot/src/BootloadManager/Checker/BootloaderCheckerInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
     /**
13 13
      * @param class-string<BootloaderInterface>|BootloaderInterface $bootloader
14 14
      */
15
-    public function canInitialize(string|BootloaderInterface $bootloader, ?BootloadConfig $config = null): bool;
15
+    public function canInitialize(string | BootloaderInterface $bootloader, ?BootloadConfig $config = null): bool;
16 16
 }
Please login to merge, or discard this patch.