Passed
Pull Request — master (#853)
by butschster
06:40
created
src/Prototype/src/Command/InjectCommand.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         PrototypeLocator $locator,
33 33
         NodeExtractor $extractor,
34 34
         PrototypeRegistry $registry
35
-    ) {
35
+    ){
36 36
         parent::__construct($locator, $extractor, $registry);
37 37
         $this->injector = new Injector();
38 38
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function perform(): int
47 47
     {
48 48
         $prototyped = $this->locator->getTargetClasses();
49
-        if ($prototyped === []) {
49
+        if ($prototyped === []){
50 50
             $this->writeln('<comment>No prototyped classes found.</comment>');
51 51
 
52 52
             return self::SUCCESS;
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 
55 55
         $targets = [];
56 56
 
57
-        foreach ($prototyped as $class) {
57
+        foreach ($prototyped as $class){
58 58
             $proto = $this->getPrototypeProperties($class, $prototyped);
59
-            if (empty($proto)) {
59
+            if (empty($proto)){
60 60
                 $modified = $this->modify($class, $proto);
61
-                if ($modified !== null) {
61
+                if ($modified !== null){
62 62
                     $targets[] = $modified;
63 63
                 }
64 64
                 continue;
65 65
             }
66 66
 
67
-            foreach ($proto as $target) {
68
-                if ($target instanceof \Throwable) {
67
+            foreach ($proto as $target){
68
+                if ($target instanceof \Throwable){
69 69
                     $targets[] = [
70 70
                         $class->getName(),
71 71
                         $target->getMessage(),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                     continue 2;
75 75
                 }
76 76
 
77
-                if ($target === null) {
77
+                if ($target === null){
78 78
                     continue 2;
79 79
                 }
80 80
             }
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
83 83
 
84 84
             $modified = $this->modify($class, $proto);
85
-            if ($modified !== null) {
85
+            if ($modified !== null){
86 86
                 $targets[] = $modified;
87 87
             }
88 88
         }
89 89
 
90
-        if (!empty($targets)) {
90
+        if (!empty($targets)){
91 91
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
92
-            foreach ($targets as $target) {
92
+            foreach ($targets as $target){
93 93
                 $grid->addRow($target);
94 94
             }
95 95
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     private function modify(\ReflectionClass $class, array $proto): ?array
103 103
     {
104 104
         $classDefinition = $this->extractor->extract($class->getFileName(), $proto);
105
-        try {
105
+        try{
106 106
             $modified = $this->injector->injectDependencies(
107 107
                 \file_get_contents($class->getFileName()),
108 108
                 $classDefinition,
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             \file_put_contents($class->getFileName(), $modified);
115 115
 
116 116
             return null;
117
-        } catch (\Throwable $e) {
117
+        }catch (\Throwable $e){
118 118
             return [$class->getName(), $e->getMessage(), \sprintf('%s:L%s', $e->getFile(), $e->getLine())];
119 119
         }
120 120
     }
Please login to merge, or discard this patch.
Braces   +25 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@  discard block
 block discarded – undo
46 46
     public function perform(): int
47 47
     {
48 48
         $prototyped = $this->locator->getTargetClasses();
49
-        if ($prototyped === []) {
49
+        if ($prototyped === [])
50
+        {
50 51
             $this->writeln('<comment>No prototyped classes found.</comment>');
51 52
 
52 53
             return self::SUCCESS;
@@ -54,18 +55,23 @@  discard block
 block discarded – undo
54 55
 
55 56
         $targets = [];
56 57
 
57
-        foreach ($prototyped as $class) {
58
+        foreach ($prototyped as $class)
59
+        {
58 60
             $proto = $this->getPrototypeProperties($class, $prototyped);
59
-            if (empty($proto)) {
61
+            if (empty($proto))
62
+            {
60 63
                 $modified = $this->modify($class, $proto);
61
-                if ($modified !== null) {
64
+                if ($modified !== null)
65
+                {
62 66
                     $targets[] = $modified;
63 67
                 }
64 68
                 continue;
65 69
             }
66 70
 
67
-            foreach ($proto as $target) {
68
-                if ($target instanceof \Throwable) {
71
+            foreach ($proto as $target)
72
+            {
73
+                if ($target instanceof \Throwable)
74
+                {
69 75
                     $targets[] = [
70 76
                         $class->getName(),
71 77
                         $target->getMessage(),
@@ -74,7 +80,8 @@  discard block
 block discarded – undo
74 80
                     continue 2;
75 81
                 }
76 82
 
77
-                if ($target === null) {
83
+                if ($target === null)
84
+                {
78 85
                     continue 2;
79 86
                 }
80 87
             }
@@ -82,14 +89,17 @@  discard block
 block discarded – undo
82 89
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
83 90
 
84 91
             $modified = $this->modify($class, $proto);
85
-            if ($modified !== null) {
92
+            if ($modified !== null)
93
+            {
86 94
                 $targets[] = $modified;
87 95
             }
88 96
         }
89 97
 
90
-        if (!empty($targets)) {
98
+        if (!empty($targets))
99
+        {
91 100
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
92
-            foreach ($targets as $target) {
101
+            foreach ($targets as $target)
102
+            {
93 103
                 $grid->addRow($target);
94 104
             }
95 105
 
@@ -102,7 +112,8 @@  discard block
 block discarded – undo
102 112
     private function modify(\ReflectionClass $class, array $proto): ?array
103 113
     {
104 114
         $classDefinition = $this->extractor->extract($class->getFileName(), $proto);
105
-        try {
115
+        try
116
+        {
106 117
             $modified = $this->injector->injectDependencies(
107 118
                 \file_get_contents($class->getFileName()),
108 119
                 $classDefinition,
@@ -114,7 +125,9 @@  discard block
 block discarded – undo
114 125
             \file_put_contents($class->getFileName(), $modified);
115 126
 
116 127
             return null;
117
-        } catch (\Throwable $e) {
128
+        }
129
+        catch (\Throwable $e)
130
+        {
118 131
             return [$class->getName(), $e->getMessage(), \sprintf('%s:L%s', $e->getFile(), $e->getLine())];
119 132
         }
120 133
     }
Please login to merge, or discard this patch.
src/Prototype/src/Bootloader/PrototypeBootloader.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     public function __construct(
75 75
         private readonly PrototypeRegistry $registry
76
-    ) {
76
+    ){
77 77
     }
78 78
 
79 79
     public function init(ConsoleBootloader $console): void
@@ -118,30 +118,30 @@  discard block
 block discarded – undo
118 118
 
119 119
     private function initDefaults(ContainerInterface $container): void
120 120
     {
121
-        foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut) {
122
-            if (\is_array($shortcut) && isset($shortcut['resolve'])) {
123
-                if (isset($shortcut['with'])) {
121
+        foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut){
122
+            if (\is_array($shortcut) && isset($shortcut['resolve'])){
123
+                if (isset($shortcut['with'])){
124 124
                     // check dependencies
125
-                    foreach ($shortcut['with'] as $dep) {
126
-                        if (!\class_exists($dep, true) && !\interface_exists($dep, true)) {
125
+                    foreach ($shortcut['with'] as $dep){
126
+                        if (!\class_exists($dep, true) && !\interface_exists($dep, true)){
127 127
                             continue 2;
128 128
                         }
129 129
                     }
130 130
                 }
131 131
 
132
-                try {
132
+                try{
133 133
                     $target = $container->get($shortcut['resolve']);
134
-                    if (\is_object($target)) {
134
+                    if (\is_object($target)){
135 135
                         $this->bindProperty($property, $target::class);
136 136
                     }
137
-                } catch (ContainerExceptionInterface) {
137
+                }catch (ContainerExceptionInterface){
138 138
                     continue;
139 139
                 }
140 140
 
141 141
                 continue;
142 142
             }
143 143
 
144
-            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true))) {
144
+            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true))){
145 145
                 $this->bindProperty($property, $shortcut);
146 146
             }
147 147
         }
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -118,30 +118,40 @@
 block discarded – undo
118 118
 
119 119
     private function initDefaults(ContainerInterface $container): void
120 120
     {
121
-        foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut) {
122
-            if (\is_array($shortcut) && isset($shortcut['resolve'])) {
123
-                if (isset($shortcut['with'])) {
121
+        foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut)
122
+        {
123
+            if (\is_array($shortcut) && isset($shortcut['resolve']))
124
+            {
125
+                if (isset($shortcut['with']))
126
+                {
124 127
                     // check dependencies
125
-                    foreach ($shortcut['with'] as $dep) {
126
-                        if (!\class_exists($dep, true) && !\interface_exists($dep, true)) {
128
+                    foreach ($shortcut['with'] as $dep)
129
+                    {
130
+                        if (!\class_exists($dep, true) && !\interface_exists($dep, true))
131
+                        {
127 132
                             continue 2;
128 133
                         }
129 134
                     }
130 135
                 }
131 136
 
132
-                try {
137
+                try
138
+                {
133 139
                     $target = $container->get($shortcut['resolve']);
134
-                    if (\is_object($target)) {
140
+                    if (\is_object($target))
141
+                    {
135 142
                         $this->bindProperty($property, $target::class);
136 143
                     }
137
-                } catch (ContainerExceptionInterface) {
144
+                }
145
+                catch (ContainerExceptionInterface)
146
+                {
138 147
                     continue;
139 148
                 }
140 149
 
141 150
                 continue;
142 151
             }
143 152
 
144
-            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true))) {
153
+            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true)))
154
+            {
145 155
                 $this->bindProperty($property, $shortcut);
146 156
             }
147 157
         }
Please login to merge, or discard this patch.
src/Prototype/src/Annotation/Parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
     {
17 17
         $lines = \explode("\n", $comment);
18 18
 
19
-        foreach ($lines as $line) {
19
+        foreach ($lines as $line){
20 20
             // strip up comment prefix
21 21
             $line = \preg_replace('/[\t ]*[\/]?\*[\/]? ?/', '', $line);
22 22
 
23
-            if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) {
23
+            if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)){
24 24
                 $this->lines[] = new Line($matches[2], $matches[1]);
25
-            } else {
25
+            }else{
26 26
                 $this->lines[] = new Line($line);
27 27
             }
28 28
         }
29 29
 
30
-        if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) {
30
+        if (isset($this->lines[0]) && $this->lines[0]->isEmpty()){
31 31
             \array_shift($this->lines);
32 32
         }
33 33
 
34
-        if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()) {
34
+        if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()){
35 35
             \array_pop($this->lines);
36 36
         }
37 37
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
         $result[] = '/**';
43 43
 
44 44
         // skip first and last tokens
45
-        foreach ($this->lines as $line) {
46
-            if ($line->type === null) {
45
+        foreach ($this->lines as $line){
46
+            if ($line->type === null){
47 47
                 $result[] = \sprintf(' * %s', $line->value);
48 48
                 continue;
49 49
             }
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,22 +16,28 @@  discard block
 block discarded – undo
16 16
     {
17 17
         $lines = \explode("\n", $comment);
18 18
 
19
-        foreach ($lines as $line) {
19
+        foreach ($lines as $line)
20
+        {
20 21
             // strip up comment prefix
21 22
             $line = \preg_replace('/[\t ]*[\/]?\*[\/]? ?/', '', $line);
22 23
 
23
-            if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) {
24
+            if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches))
25
+            {
24 26
                 $this->lines[] = new Line($matches[2], $matches[1]);
25
-            } else {
27
+            }
28
+            else
29
+            {
26 30
                 $this->lines[] = new Line($line);
27 31
             }
28 32
         }
29 33
 
30
-        if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) {
34
+        if (isset($this->lines[0]) && $this->lines[0]->isEmpty())
35
+        {
31 36
             \array_shift($this->lines);
32 37
         }
33 38
 
34
-        if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()) {
39
+        if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty())
40
+        {
35 41
             \array_pop($this->lines);
36 42
         }
37 43
     }
@@ -42,8 +48,10 @@  discard block
 block discarded – undo
42 48
         $result[] = '/**';
43 49
 
44 50
         // skip first and last tokens
45
-        foreach ($this->lines as $line) {
46
-            if ($line->type === null) {
51
+        foreach ($this->lines as $line)
52
+        {
53
+            if ($line->type === null)
54
+            {
47 55
                 $result[] = \sprintf(' * %s', $line->value);
48 56
                 continue;
49 57
             }
Please login to merge, or discard this patch.
src/Prototype/src/Annotation/Prototyped.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
      */
26 26
     public function __construct(
27 27
         public readonly string $property
28
-    ) {
28
+    ){
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
src/Models/src/DataEntity.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
             ModelSchema::MUTATOR_SETTER => static::SETTERS
86 86
         };
87 87
 
88
-        if (isset($target[$field])) {
88
+        if (isset($target[$field])){
89 89
             return $target[$field];
90 90
         }
91 91
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@
 block discarded – undo
85 85
             ModelSchema::MUTATOR_SETTER => static::SETTERS
86 86
         };
87 87
 
88
-        if (isset($target[$field])) {
88
+        if (isset($target[$field]))
89
+        {
89 90
             return $target[$field];
90 91
         }
91 92
 
Please login to merge, or discard this patch.
src/Models/src/Reflection/ReflectionEntity.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function getSecured(): mixed
72 72
     {
73
-        if ($this->getProperty('secured', true) === '*') {
73
+        if ($this->getProperty('secured', true) === '*'){
74 74
             return $this->getProperty('secured', true);
75 75
         }
76 76
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
     public function declaredMethods(): array
106 106
     {
107 107
         $methods = [];
108
-        foreach ($this->getMethods() as $method) {
109
-            if ($method->getDeclaringClass()->getName() != $this->getName()) {
108
+        foreach ($this->getMethods() as $method){
109
+            if ($method->getDeclaringClass()->getName() != $this->getName()){
110 110
                 continue;
111 111
             }
112 112
 
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
             self::MUTATOR_ACCESSOR => [],
137 137
         ];
138 138
 
139
-        foreach ((array)$this->getProperty('getters', true) as $field => $filter) {
139
+        foreach ((array)$this->getProperty('getters', true) as $field => $filter){
140 140
             $mutators[self::MUTATOR_GETTER][$field] = $filter;
141 141
         }
142 142
 
143
-        foreach ((array)$this->getProperty('setters', true) as $field => $filter) {
143
+        foreach ((array)$this->getProperty('setters', true) as $field => $filter){
144 144
             $mutators[self::MUTATOR_SETTER][$field] = $filter;
145 145
         }
146 146
 
147
-        foreach ((array)$this->getProperty('accessors', true) as $field => $filter) {
147
+        foreach ((array)$this->getProperty('accessors', true) as $field => $filter){
148 148
             $mutators[self::MUTATOR_ACCESSOR][$field] = $filter;
149 149
         }
150 150
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getProperty(string $property, bool $merge = false): mixed
162 162
     {
163
-        if (isset($this->propertyCache[$property])) {
163
+        if (isset($this->propertyCache[$property])){
164 164
             //Property merging and trait events are pretty slow
165 165
             return $this->propertyCache[$property];
166 166
         }
@@ -168,27 +168,27 @@  discard block
 block discarded – undo
168 168
         $properties = $this->reflection->getDefaultProperties();
169 169
         $constants = $this->reflection->getConstants();
170 170
 
171
-        if (isset($properties[$property])) {
171
+        if (isset($properties[$property])){
172 172
             //Read from default value
173 173
             $value = $properties[$property];
174
-        } elseif (isset($constants[\strtoupper($property)])) {
174
+        } elseif (isset($constants[\strtoupper($property)])){
175 175
             //Read from a constant
176 176
             $value = $constants[\strtoupper($property)];
177
-        } else {
177
+        }else{
178 178
             return null;
179 179
         }
180 180
 
181 181
         //Merge with parent value requested
182
-        if ($merge && \is_array($value) && !empty($parent = $this->parentReflection())) {
182
+        if ($merge && \is_array($value) && !empty($parent = $this->parentReflection())){
183 183
             $parentValue = $parent->getProperty($property, $merge);
184 184
 
185
-            if (\is_array($parentValue)) {
185
+            if (\is_array($parentValue)){
186 186
                 //Class values prior to parent values
187 187
                 $value = \array_merge($parentValue, $value);
188 188
             }
189 189
         }
190 190
 
191
-        if (!$this->reflection->isSubclassOf(SchematicEntity::class)) {
191
+        if (!$this->reflection->isSubclassOf(SchematicEntity::class)){
192 192
             return $value;
193 193
         }
194 194
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     {
204 204
         $parentClass = $this->reflection->getParentClass();
205 205
 
206
-        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) {
206
+        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS){
207 207
             $parent = clone $this;
208 208
             $parent->reflection = $this->getParentClass();
209 209
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function getSecured(): mixed
72 72
     {
73
-        if ($this->getProperty('secured', true) === '*') {
73
+        if ($this->getProperty('secured', true) === '*')
74
+        {
74 75
             return $this->getProperty('secured', true);
75 76
         }
76 77
 
@@ -105,8 +106,10 @@  discard block
 block discarded – undo
105 106
     public function declaredMethods(): array
106 107
     {
107 108
         $methods = [];
108
-        foreach ($this->getMethods() as $method) {
109
-            if ($method->getDeclaringClass()->getName() != $this->getName()) {
109
+        foreach ($this->getMethods() as $method)
110
+        {
111
+            if ($method->getDeclaringClass()->getName() != $this->getName())
112
+            {
110 113
                 continue;
111 114
             }
112 115
 
@@ -136,15 +139,18 @@  discard block
 block discarded – undo
136 139
             self::MUTATOR_ACCESSOR => [],
137 140
         ];
138 141
 
139
-        foreach ((array)$this->getProperty('getters', true) as $field => $filter) {
142
+        foreach ((array)$this->getProperty('getters', true) as $field => $filter)
143
+        {
140 144
             $mutators[self::MUTATOR_GETTER][$field] = $filter;
141 145
         }
142 146
 
143
-        foreach ((array)$this->getProperty('setters', true) as $field => $filter) {
147
+        foreach ((array)$this->getProperty('setters', true) as $field => $filter)
148
+        {
144 149
             $mutators[self::MUTATOR_SETTER][$field] = $filter;
145 150
         }
146 151
 
147
-        foreach ((array)$this->getProperty('accessors', true) as $field => $filter) {
152
+        foreach ((array)$this->getProperty('accessors', true) as $field => $filter)
153
+        {
148 154
             $mutators[self::MUTATOR_ACCESSOR][$field] = $filter;
149 155
         }
150 156
 
@@ -160,7 +166,8 @@  discard block
 block discarded – undo
160 166
      */
161 167
     public function getProperty(string $property, bool $merge = false): mixed
162 168
     {
163
-        if (isset($this->propertyCache[$property])) {
169
+        if (isset($this->propertyCache[$property]))
170
+        {
164 171
             //Property merging and trait events are pretty slow
165 172
             return $this->propertyCache[$property];
166 173
         }
@@ -168,27 +175,35 @@  discard block
 block discarded – undo
168 175
         $properties = $this->reflection->getDefaultProperties();
169 176
         $constants = $this->reflection->getConstants();
170 177
 
171
-        if (isset($properties[$property])) {
178
+        if (isset($properties[$property]))
179
+        {
172 180
             //Read from default value
173 181
             $value = $properties[$property];
174
-        } elseif (isset($constants[\strtoupper($property)])) {
182
+        }
183
+        elseif (isset($constants[\strtoupper($property)]))
184
+        {
175 185
             //Read from a constant
176 186
             $value = $constants[\strtoupper($property)];
177
-        } else {
187
+        }
188
+        else
189
+        {
178 190
             return null;
179 191
         }
180 192
 
181 193
         //Merge with parent value requested
182
-        if ($merge && \is_array($value) && !empty($parent = $this->parentReflection())) {
194
+        if ($merge && \is_array($value) && !empty($parent = $this->parentReflection()))
195
+        {
183 196
             $parentValue = $parent->getProperty($property, $merge);
184 197
 
185
-            if (\is_array($parentValue)) {
198
+            if (\is_array($parentValue))
199
+            {
186 200
                 //Class values prior to parent values
187 201
                 $value = \array_merge($parentValue, $value);
188 202
             }
189 203
         }
190 204
 
191
-        if (!$this->reflection->isSubclassOf(SchematicEntity::class)) {
205
+        if (!$this->reflection->isSubclassOf(SchematicEntity::class))
206
+        {
192 207
             return $value;
193 208
         }
194 209
 
@@ -203,7 +218,8 @@  discard block
 block discarded – undo
203 218
     {
204 219
         $parentClass = $this->reflection->getParentClass();
205 220
 
206
-        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) {
221
+        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS)
222
+        {
207 223
             $parent = clone $this;
208 224
             $parent->reflection = $this->getParentClass();
209 225
 
Please login to merge, or discard this patch.
src/Models/src/SchematicEntity.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     public function __construct(
13 13
         array $data,
14 14
         private array $schema
15
-    ) {
15
+    ){
16 16
         parent::__construct($data);
17 17
     }
18 18
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     protected function getMutator(string $field, string $type): mixed
30 30
     {
31
-        if (isset($this->schema[ModelSchema::MUTATORS][$type][$field])) {
31
+        if (isset($this->schema[ModelSchema::MUTATORS][$type][$field])){
32 32
             return $this->schema[ModelSchema::MUTATORS][$type][$field];
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@
 block discarded – undo
28 28
 
29 29
     protected function getMutator(string $field, string $type): mixed
30 30
     {
31
-        if (isset($this->schema[ModelSchema::MUTATORS][$type][$field])) {
31
+        if (isset($this->schema[ModelSchema::MUTATORS][$type][$field]))
32
+        {
32 33
             return $this->schema[ModelSchema::MUTATORS][$type][$field];
33 34
         }
34 35
 
Please login to merge, or discard this patch.
src/Models/src/AbstractEntity.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private array $fields = []
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     /**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function hasField(string $name): bool
50 50
     {
51
-        if (!\array_key_exists($name, $this->fields)) {
51
+        if (!\array_key_exists($name, $this->fields)){
52 52
             return false;
53 53
         }
54 54
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function setField(string $name, mixed $value, bool $filter = true): self
64 64
     {
65
-        if ($value instanceof ValueInterface) {
65
+        if ($value instanceof ValueInterface){
66 66
             //In case of non scalar values filters must be bypassed (check accessor compatibility?)
67 67
             $this->fields[$name] = clone $value;
68 68
 
69 69
             return $this;
70 70
         }
71 71
 
72
-        if (!$filter || (\is_null($value) && $this->isNullable($name))) {
72
+        if (!$filter || (\is_null($value) && $this->isNullable($name))){
73 73
             //Bypassing all filters
74 74
             $this->fields[$name] = $value;
75 75
 
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
         //Checking if field have accessor
80 80
         $accessor = $this->getMutator($name, ModelSchema::MUTATOR_ACCESSOR);
81 81
 
82
-        if ($accessor !== null) {
82
+        if ($accessor !== null){
83 83
             //Setting value thought associated accessor
84 84
             $this->thoughValue($accessor, $name, $value);
85
-        } else {
85
+        }else{
86 86
             //Setting value thought setter filter (if any)
87 87
             $this->setMutated($name, $value);
88 88
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $value = $this->hasField($name) ? $this->fields[$name] : $default;
101 101
 
102
-        if ($value instanceof ValueInterface || (\is_null($value) && $this->isNullable($name))) {
102
+        if ($value instanceof ValueInterface || (\is_null($value) && $this->isNullable($name))){
103 103
             //Direct access to value when value is accessor or null and declared as nullable
104 104
             return $value;
105 105
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         //Checking if field have accessor (decorator)
108 108
         $accessor = $this->getMutator($name, ModelSchema::MUTATOR_ACCESSOR);
109 109
 
110
-        if (!empty($accessor)) {
110
+        if (!empty($accessor)){
111 111
             return $this->fields[$name] = $this->createValue($accessor, $name, $value);
112 112
         }
113 113
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function setFields(iterable $fields = [], bool $all = false): self
128 128
     {
129
-        if (!\is_array($fields) && !$fields instanceof \Traversable) {
129
+        if (!\is_array($fields) && !$fields instanceof \Traversable){
130 130
             return $this;
131 131
         }
132 132
 
133
-        foreach ($fields as $name => $value) {
134
-            if ($all || $this->isFillable($name)) {
135
-                try {
133
+        foreach ($fields as $name => $value){
134
+            if ($all || $this->isFillable($name)){
135
+                try{
136 136
                     $this->setField($name, $value, true);
137
-                } catch (AccessExceptionInterface) {
137
+                }catch (AccessExceptionInterface){
138 138
                     // We are suppressing field setting exceptions
139 139
                 }
140 140
             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     public function getFields(bool $filter = true): array
152 152
     {
153 153
         $result = [];
154
-        foreach (\array_keys($this->fields) as $name) {
154
+        foreach (\array_keys($this->fields) as $name){
155 155
             $result[$name] = $this->getField($name, null, $filter);
156 156
         }
157 157
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function getValue(): array
200 200
     {
201 201
         $result = [];
202
-        foreach ($this->fields as $field => $value) {
202
+        foreach ($this->fields as $field => $value){
203 203
             $result[$field] = $value instanceof ValueInterface ? $value->getValue() : $value;
204 204
         }
205 205
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
         mixed $value,
276 276
         array $context = []
277 277
     ): ValueInterface {
278
-        if (!\is_string($type) || !\class_exists($type)) {
278
+        if (!\is_string($type) || !\class_exists($type)){
279 279
             throw new EntityException(
280
-                \sprintf('Unable to create accessor for field `%s` in ', $name) . static::class
280
+                \sprintf('Unable to create accessor for field `%s` in ', $name).static::class
281 281
             );
282 282
         }
283 283
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
     {
293 293
         $getter = $this->getMutator($name, ModelSchema::MUTATOR_GETTER);
294 294
 
295
-        if ($filter && !empty($getter)) {
296
-            try {
295
+        if ($filter && !empty($getter)){
296
+            try{
297 297
                 return \call_user_func($getter, $value);
298
-            } catch (\Exception) {
298
+            }catch (\Exception){
299 299
                 //Trying to filter null value, every filter must support it
300 300
                 return \call_user_func($getter, null);
301 301
             }
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
     {
312 312
         $setter = $this->getMutator($name, ModelSchema::MUTATOR_SETTER);
313 313
 
314
-        if (!empty($setter)) {
315
-            try {
314
+        if (!empty($setter)){
315
+            try{
316 316
                 $this->fields[$name] = \call_user_func($setter, $value);
317
-            } catch (\Exception) {
317
+            }catch (\Exception){
318 318
                 //Exceptional situation, we are choosing to keep original field value
319 319
             }
320
-        } else {
320
+        }else{
321 321
             $this->fields[$name] = $value;
322 322
         }
323 323
     }
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
      *
328 328
      * @param string|array $type Accessor definition (implementation specific).
329 329
      */
330
-    private function thoughValue(array|string $type, string $name, mixed $value): void
330
+    private function thoughValue(array | string $type, string $name, mixed $value): void
331 331
     {
332 332
         $field = $this->fields[$name] ?? null;
333 333
 
334
-        if (empty($field) || !($field instanceof ValueInterface)) {
334
+        if (empty($field) || !($field instanceof ValueInterface)){
335 335
             //New field representation
336 336
             $field = $this->createValue($type, $name, $value);
337 337
 
Please login to merge, or discard this patch.
Braces   +51 added lines, -23 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function hasField(string $name): bool
50 50
     {
51
-        if (!\array_key_exists($name, $this->fields)) {
51
+        if (!\array_key_exists($name, $this->fields))
52
+        {
52 53
             return false;
53 54
         }
54 55
 
@@ -62,14 +63,16 @@  discard block
 block discarded – undo
62 63
      */
63 64
     public function setField(string $name, mixed $value, bool $filter = true): self
64 65
     {
65
-        if ($value instanceof ValueInterface) {
66
+        if ($value instanceof ValueInterface)
67
+        {
66 68
             //In case of non scalar values filters must be bypassed (check accessor compatibility?)
67 69
             $this->fields[$name] = clone $value;
68 70
 
69 71
             return $this;
70 72
         }
71 73
 
72
-        if (!$filter || (\is_null($value) && $this->isNullable($name))) {
74
+        if (!$filter || (\is_null($value) && $this->isNullable($name)))
75
+        {
73 76
             //Bypassing all filters
74 77
             $this->fields[$name] = $value;
75 78
 
@@ -79,10 +82,13 @@  discard block
 block discarded – undo
79 82
         //Checking if field have accessor
80 83
         $accessor = $this->getMutator($name, ModelSchema::MUTATOR_ACCESSOR);
81 84
 
82
-        if ($accessor !== null) {
85
+        if ($accessor !== null)
86
+        {
83 87
             //Setting value thought associated accessor
84 88
             $this->thoughValue($accessor, $name, $value);
85
-        } else {
89
+        }
90
+        else
91
+        {
86 92
             //Setting value thought setter filter (if any)
87 93
             $this->setMutated($name, $value);
88 94
         }
@@ -99,7 +105,8 @@  discard block
 block discarded – undo
99 105
     {
100 106
         $value = $this->hasField($name) ? $this->fields[$name] : $default;
101 107
 
102
-        if ($value instanceof ValueInterface || (\is_null($value) && $this->isNullable($name))) {
108
+        if ($value instanceof ValueInterface || (\is_null($value) && $this->isNullable($name)))
109
+        {
103 110
             //Direct access to value when value is accessor or null and declared as nullable
104 111
             return $value;
105 112
         }
@@ -107,7 +114,8 @@  discard block
 block discarded – undo
107 114
         //Checking if field have accessor (decorator)
108 115
         $accessor = $this->getMutator($name, ModelSchema::MUTATOR_ACCESSOR);
109 116
 
110
-        if (!empty($accessor)) {
117
+        if (!empty($accessor))
118
+        {
111 119
             return $this->fields[$name] = $this->createValue($accessor, $name, $value);
112 120
         }
113 121
 
@@ -126,15 +134,21 @@  discard block
 block discarded – undo
126 134
      */
127 135
     public function setFields(iterable $fields = [], bool $all = false): self
128 136
     {
129
-        if (!\is_array($fields) && !$fields instanceof \Traversable) {
137
+        if (!\is_array($fields) && !$fields instanceof \Traversable)
138
+        {
130 139
             return $this;
131 140
         }
132 141
 
133
-        foreach ($fields as $name => $value) {
134
-            if ($all || $this->isFillable($name)) {
135
-                try {
142
+        foreach ($fields as $name => $value)
143
+        {
144
+            if ($all || $this->isFillable($name))
145
+            {
146
+                try
147
+                {
136 148
                     $this->setField($name, $value, true);
137
-                } catch (AccessExceptionInterface) {
149
+                }
150
+                catch (AccessExceptionInterface)
151
+                {
138 152
                     // We are suppressing field setting exceptions
139 153
                 }
140 154
             }
@@ -151,7 +165,8 @@  discard block
 block discarded – undo
151 165
     public function getFields(bool $filter = true): array
152 166
     {
153 167
         $result = [];
154
-        foreach (\array_keys($this->fields) as $name) {
168
+        foreach (\array_keys($this->fields) as $name)
169
+        {
155 170
             $result[$name] = $this->getField($name, null, $filter);
156 171
         }
157 172
 
@@ -199,7 +214,8 @@  discard block
 block discarded – undo
199 214
     public function getValue(): array
200 215
     {
201 216
         $result = [];
202
-        foreach ($this->fields as $field => $value) {
217
+        foreach ($this->fields as $field => $value)
218
+        {
203 219
             $result[$field] = $value instanceof ValueInterface ? $value->getValue() : $value;
204 220
         }
205 221
 
@@ -275,7 +291,8 @@  discard block
 block discarded – undo
275 291
         mixed $value,
276 292
         array $context = []
277 293
     ): ValueInterface {
278
-        if (!\is_string($type) || !\class_exists($type)) {
294
+        if (!\is_string($type) || !\class_exists($type))
295
+        {
279 296
             throw new EntityException(
280 297
                 \sprintf('Unable to create accessor for field `%s` in ', $name) . static::class
281 298
             );
@@ -292,10 +309,14 @@  discard block
 block discarded – undo
292 309
     {
293 310
         $getter = $this->getMutator($name, ModelSchema::MUTATOR_GETTER);
294 311
 
295
-        if ($filter && !empty($getter)) {
296
-            try {
312
+        if ($filter && !empty($getter))
313
+        {
314
+            try
315
+            {
297 316
                 return \call_user_func($getter, $value);
298
-            } catch (\Exception) {
317
+            }
318
+            catch (\Exception)
319
+            {
299 320
                 //Trying to filter null value, every filter must support it
300 321
                 return \call_user_func($getter, null);
301 322
             }
@@ -311,13 +332,19 @@  discard block
 block discarded – undo
311 332
     {
312 333
         $setter = $this->getMutator($name, ModelSchema::MUTATOR_SETTER);
313 334
 
314
-        if (!empty($setter)) {
315
-            try {
335
+        if (!empty($setter))
336
+        {
337
+            try
338
+            {
316 339
                 $this->fields[$name] = \call_user_func($setter, $value);
317
-            } catch (\Exception) {
340
+            }
341
+            catch (\Exception)
342
+            {
318 343
                 //Exceptional situation, we are choosing to keep original field value
319 344
             }
320
-        } else {
345
+        }
346
+        else
347
+        {
321 348
             $this->fields[$name] = $value;
322 349
         }
323 350
     }
@@ -331,7 +358,8 @@  discard block
 block discarded – undo
331 358
     {
332 359
         $field = $this->fields[$name] ?? null;
333 360
 
334
-        if (empty($field) || !($field instanceof ValueInterface)) {
361
+        if (empty($field) || !($field instanceof ValueInterface))
362
+        {
335 363
             //New field representation
336 364
             $field = $this->createValue($type, $name, $value);
337 365
 
Please login to merge, or discard this patch.
src/Debug/src/State.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
     public function setTags(array $tags): void
20 20
     {
21 21
         $setTags = [];
22
-        foreach ($tags as $key => $value) {
23
-            if (!\is_string($value)) {
22
+        foreach ($tags as $key => $value){
23
+            if (!\is_string($value)){
24 24
                 throw new StateException(\sprintf(
25 25
                     'Invalid tag value, string expected got %s',
26 26
                     get_debug_type($value)
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,10 @@
 block discarded – undo
19 19
     public function setTags(array $tags): void
20 20
     {
21 21
         $setTags = [];
22
-        foreach ($tags as $key => $value) {
23
-            if (!\is_string($value)) {
22
+        foreach ($tags as $key => $value)
23
+        {
24
+            if (!\is_string($value))
25
+            {
24 26
                 throw new StateException(\sprintf(
25 27
                     'Invalid tag value, string expected got %s',
26 28
                     get_debug_type($value)
Please login to merge, or discard this patch.