@@ -19,21 +19,21 @@ |
||
19 | 19 | string $position, |
20 | 20 | private readonly ?string $key, |
21 | 21 | private mixed $value |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | $this->position = $position === '.' ? '' : $position; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function patch(array $config): array |
27 | 27 | { |
28 | - try { |
|
28 | + try{ |
|
29 | 29 | $_target = &$this->dotGet($config, $this->position); |
30 | 30 | |
31 | - if ($this->key !== null) { |
|
31 | + if ($this->key !== null){ |
|
32 | 32 | $_target = \array_merge([$this->key => $this->value], $_target); |
33 | - } else { |
|
33 | + }else{ |
|
34 | 34 | \array_unshift($_target, $this->value); |
35 | 35 | } |
36 | - } catch (DotNotFoundException $e) { |
|
36 | + }catch (DotNotFoundException $e){ |
|
37 | 37 | throw new PatchException($e->getMessage(), $e->getCode(), $e); |
38 | 38 | } |
39 | 39 |
@@ -25,15 +25,21 @@ |
||
25 | 25 | |
26 | 26 | public function patch(array $config): array |
27 | 27 | { |
28 | - try { |
|
28 | + try |
|
29 | + { |
|
29 | 30 | $_target = &$this->dotGet($config, $this->position); |
30 | 31 | |
31 | - if ($this->key !== null) { |
|
32 | + if ($this->key !== null) |
|
33 | + { |
|
32 | 34 | $_target = \array_merge([$this->key => $this->value], $_target); |
33 | - } else { |
|
35 | + } |
|
36 | + else |
|
37 | + { |
|
34 | 38 | \array_unshift($_target, $this->value); |
35 | 39 | } |
36 | - } catch (DotNotFoundException $e) { |
|
40 | + } |
|
41 | + catch (DotNotFoundException $e) |
|
42 | + { |
|
37 | 43 | throw new PatchException($e->getMessage(), $e->getCode(), $e); |
38 | 44 | } |
39 | 45 |
@@ -19,15 +19,15 @@ |
||
19 | 19 | public function __construct( |
20 | 20 | private string $key, |
21 | 21 | private mixed $value |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function patch(array $config): array |
26 | 26 | { |
27 | - try { |
|
27 | + try{ |
|
28 | 28 | $_target = &$this->dotGet($config, $this->key); |
29 | 29 | $_target = $this->value; |
30 | - } catch (DotNotFoundException $e) { |
|
30 | + }catch (DotNotFoundException $e){ |
|
31 | 31 | throw new PatchException($e->getMessage(), $e->getCode(), $e); |
32 | 32 | } |
33 | 33 |
@@ -24,10 +24,13 @@ |
||
24 | 24 | |
25 | 25 | public function patch(array $config): array |
26 | 26 | { |
27 | - try { |
|
27 | + try |
|
28 | + { |
|
28 | 29 | $_target = &$this->dotGet($config, $this->key); |
29 | 30 | $_target = $this->value; |
30 | - } catch (DotNotFoundException $e) { |
|
31 | + } |
|
32 | + catch (DotNotFoundException $e) |
|
33 | + { |
|
31 | 34 | throw new PatchException($e->getMessage(), $e->getCode(), $e); |
32 | 35 | } |
33 | 36 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __clone() |
18 | 18 | { |
19 | - foreach ($this->routes as $name => $route) { |
|
19 | + foreach ($this->routes as $name => $route){ |
|
20 | 20 | $this->routes[$name] = clone $route; |
21 | 21 | } |
22 | 22 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * |
91 | 91 | * TODO add return type |
92 | 92 | */ |
93 | - public function remove(string|array $name) |
|
93 | + public function remove(string | array $name) |
|
94 | 94 | { |
95 | - foreach ((array) $name as $n) { |
|
95 | + foreach ((array)$name as $n){ |
|
96 | 96 | unset($this->routes[$n]); |
97 | 97 | } |
98 | 98 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function addCollection(self $collection) |
106 | 106 | { |
107 | - foreach ($collection->all() as $name => $route) { |
|
107 | + foreach ($collection->all() as $name => $route){ |
|
108 | 108 | $this->routes[$name] = $route; |
109 | 109 | } |
110 | 110 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function group(string $group) |
122 | 122 | { |
123 | - foreach ($this->routes as $route) { |
|
123 | + foreach ($this->routes as $route){ |
|
124 | 124 | $route->group($group); |
125 | 125 | } |
126 | 126 | } |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __clone() |
18 | 18 | { |
19 | - foreach ($this->routes as $name => $route) { |
|
19 | + foreach ($this->routes as $name => $route) |
|
20 | + { |
|
20 | 21 | $this->routes[$name] = clone $route; |
21 | 22 | } |
22 | 23 | } |
@@ -92,7 +93,8 @@ discard block |
||
92 | 93 | */ |
93 | 94 | public function remove(string|array $name) |
94 | 95 | { |
95 | - foreach ((array) $name as $n) { |
|
96 | + foreach ((array) $name as $n) |
|
97 | + { |
|
96 | 98 | unset($this->routes[$n]); |
97 | 99 | } |
98 | 100 | } |
@@ -104,7 +106,8 @@ discard block |
||
104 | 106 | */ |
105 | 107 | public function addCollection(self $collection) |
106 | 108 | { |
107 | - foreach ($collection->all() as $name => $route) { |
|
109 | + foreach ($collection->all() as $name => $route) |
|
110 | + { |
|
108 | 111 | $this->routes[$name] = $route; |
109 | 112 | } |
110 | 113 | } |
@@ -120,7 +123,8 @@ discard block |
||
120 | 123 | */ |
121 | 124 | public function group(string $group) |
122 | 125 | { |
123 | - foreach ($this->routes as $route) { |
|
126 | + foreach ($this->routes as $route) |
|
127 | + { |
|
124 | 128 | $route->group($group); |
125 | 129 | } |
126 | 130 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct( |
22 | 22 | private readonly FactoryInterface $factory |
23 | - ) { |
|
23 | + ){ |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getGroup(string $name): RouteGroup |
30 | 30 | { |
31 | - if (!isset($this->groups[$name])) { |
|
31 | + if (!isset($this->groups[$name])){ |
|
32 | 32 | $this->groups[$name] = $this->factory->make(RouteGroup::class); |
33 | 33 | } |
34 | 34 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function registerRoutes(RouterInterface $router): void |
62 | 62 | { |
63 | - foreach ($this->groups as $group) { |
|
63 | + foreach ($this->groups as $group){ |
|
64 | 64 | $group->register($router, $this->factory); |
65 | 65 | } |
66 | 66 | } |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getGroup(string $name): RouteGroup |
30 | 30 | { |
31 | - if (!isset($this->groups[$name])) { |
|
31 | + if (!isset($this->groups[$name])) |
|
32 | + { |
|
32 | 33 | $this->groups[$name] = $this->factory->make(RouteGroup::class); |
33 | 34 | } |
34 | 35 | |
@@ -60,7 +61,8 @@ discard block |
||
60 | 61 | */ |
61 | 62 | public function registerRoutes(RouterInterface $router): void |
62 | 63 | { |
63 | - foreach ($this->groups as $group) { |
|
64 | + foreach ($this->groups as $group) |
|
65 | + { |
|
64 | 66 | $group->register($router, $this->factory); |
65 | 67 | } |
66 | 68 | } |
@@ -13,6 +13,6 @@ |
||
13 | 13 | public readonly string $id, |
14 | 14 | public readonly mixed $payload, |
15 | 15 | public readonly array $headers = [] |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $reflection = new \ReflectionClass($object); |
25 | 25 | |
26 | 26 | /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ |
27 | - if ($reflection->implementsInterface(QueueableInterface::class)) { |
|
27 | + if ($reflection->implementsInterface(QueueableInterface::class)){ |
|
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $reflection = new \ReflectionClass($object); |
40 | 40 | |
41 | 41 | $attribute = $this->reader->firstClassMetadata($reflection, Queueable::class); |
42 | - if ($attribute !== null) { |
|
42 | + if ($attribute !== null){ |
|
43 | 43 | return $attribute->queue; |
44 | 44 | } |
45 | 45 | |
46 | - if (\is_object($object) && $reflection->hasMethod('getQueue')) { |
|
46 | + if (\is_object($object) && $reflection->hasMethod('getQueue')){ |
|
47 | 47 | return $reflection->getMethod('getQueue')->invoke($object); |
48 | 48 | } |
49 | 49 |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | $reflection = new \ReflectionClass($object); |
25 | 25 | |
26 | 26 | /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ |
27 | - if ($reflection->implementsInterface(QueueableInterface::class)) { |
|
27 | + if ($reflection->implementsInterface(QueueableInterface::class)) |
|
28 | + { |
|
28 | 29 | return true; |
29 | 30 | } |
30 | 31 | |
@@ -39,11 +40,13 @@ discard block |
||
39 | 40 | $reflection = new \ReflectionClass($object); |
40 | 41 | |
41 | 42 | $attribute = $this->reader->firstClassMetadata($reflection, Queueable::class); |
42 | - if ($attribute !== null) { |
|
43 | + if ($attribute !== null) |
|
44 | + { |
|
43 | 45 | return $attribute->queue; |
44 | 46 | } |
45 | 47 | |
46 | - if (\is_object($object) && $reflection->hasMethod('getQueue')) { |
|
48 | + if (\is_object($object) && $reflection->hasMethod('getQueue')) |
|
49 | + { |
|
47 | 50 | return $reflection->getMethod('getQueue')->invoke($object); |
48 | 51 | } |
49 | 52 |
@@ -60,8 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function has(string $name): bool |
62 | 62 | { |
63 | - foreach ($this->elements as $element) { |
|
64 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
63 | + foreach ($this->elements as $element) |
|
64 | + { |
|
65 | + if ($element instanceof NamedInterface && $element->getName() === $name) |
|
66 | + { |
|
65 | 67 | return true; |
66 | 68 | } |
67 | 69 | } |
@@ -79,15 +81,18 @@ discard block |
||
79 | 81 | $reflector = new \ReflectionObject($element); |
80 | 82 | |
81 | 83 | $allowed = false; |
82 | - foreach ($this->allowed as $class) { |
|
84 | + foreach ($this->allowed as $class) |
|
85 | + { |
|
83 | 86 | /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ |
84 | - if ($reflector->isSubclassOf($class) || $element::class === $class) { |
|
87 | + if ($reflector->isSubclassOf($class) || $element::class === $class) |
|
88 | + { |
|
85 | 89 | $allowed = true; |
86 | 90 | break; |
87 | 91 | } |
88 | 92 | } |
89 | 93 | |
90 | - if (!$allowed) { |
|
94 | + if (!$allowed) |
|
95 | + { |
|
91 | 96 | $type = $element::class; |
92 | 97 | throw new ReactorException(\sprintf("Elements with type '%s' are not allowed", $type)); |
93 | 98 | } |
@@ -117,8 +122,10 @@ discard block |
||
117 | 122 | */ |
118 | 123 | public function remove(string $name): self |
119 | 124 | { |
120 | - foreach ($this->elements as $index => $element) { |
|
121 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
125 | + foreach ($this->elements as $index => $element) |
|
126 | + { |
|
127 | + if ($element instanceof NamedInterface && $element->getName() === $name) |
|
128 | + { |
|
122 | 129 | unset($this->elements[$index]); |
123 | 130 | } |
124 | 131 | } |
@@ -170,8 +177,10 @@ discard block |
||
170 | 177 | */ |
171 | 178 | protected function find(string $name): AggregableInterface |
172 | 179 | { |
173 | - foreach ($this->elements as $element) { |
|
174 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
180 | + foreach ($this->elements as $element) |
|
181 | + { |
|
182 | + if ($element instanceof NamedInterface && $element->getName() === $name) |
|
183 | + { |
|
175 | 184 | return $element; |
176 | 185 | } |
177 | 186 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function __construct( |
23 | 23 | private readonly array $allowed, |
24 | 24 | private array $elements = [] |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function has(string $name): bool |
62 | 62 | { |
63 | - foreach ($this->elements as $element) { |
|
64 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
63 | + foreach ($this->elements as $element){ |
|
64 | + if ($element instanceof NamedInterface && $element->getName() === $name){ |
|
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | } |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | $reflector = new \ReflectionObject($element); |
80 | 80 | |
81 | 81 | $allowed = false; |
82 | - foreach ($this->allowed as $class) { |
|
82 | + foreach ($this->allowed as $class){ |
|
83 | 83 | /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ |
84 | - if ($reflector->isSubclassOf($class) || $element::class === $class) { |
|
84 | + if ($reflector->isSubclassOf($class) || $element::class === $class){ |
|
85 | 85 | $allowed = true; |
86 | 86 | break; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - if (!$allowed) { |
|
90 | + if (!$allowed){ |
|
91 | 91 | $type = $element::class; |
92 | 92 | throw new ReactorException(\sprintf("Elements with type '%s' are not allowed", $type)); |
93 | 93 | } |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function remove(string $name): self |
119 | 119 | { |
120 | - foreach ($this->elements as $index => $element) { |
|
121 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
120 | + foreach ($this->elements as $index => $element){ |
|
121 | + if ($element instanceof NamedInterface && $element->getName() === $name){ |
|
122 | 122 | unset($this->elements[$index]); |
123 | 123 | } |
124 | 124 | } |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | */ |
171 | 171 | protected function find(string $name): AggregableInterface |
172 | 172 | { |
173 | - foreach ($this->elements as $element) { |
|
174 | - if ($element instanceof NamedInterface && $element->getName() === $name) { |
|
173 | + foreach ($this->elements as $element){ |
|
174 | + if ($element instanceof NamedInterface && $element->getName() === $name){ |
|
175 | 175 | return $element; |
176 | 176 | } |
177 | 177 | } |
@@ -70,7 +70,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,28 +168,28 @@ discard block |
||
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 | 191 | /** @psalm-suppress TypeDoesNotContainType https://github.com/vimeo/psalm/issues/9489 */ |
192 | - if (!$this->reflection->isSubclassOf(SchematicEntity::class)) { |
|
192 | + if (!$this->reflection->isSubclassOf(SchematicEntity::class)){ |
|
193 | 193 | return $value; |
194 | 194 | } |
195 | 195 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | $parentClass = $this->reflection->getParentClass(); |
206 | 206 | |
207 | - if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) { |
|
207 | + if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS){ |
|
208 | 208 | $parent = clone $this; |
209 | 209 | $parent->reflection = $this->getParentClass(); |
210 | 210 |
@@ -70,7 +70,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,28 +175,36 @@ discard block |
||
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 | 205 | /** @psalm-suppress TypeDoesNotContainType https://github.com/vimeo/psalm/issues/9489 */ |
192 | - if (!$this->reflection->isSubclassOf(SchematicEntity::class)) { |
|
206 | + if (!$this->reflection->isSubclassOf(SchematicEntity::class)) |
|
207 | + { |
|
193 | 208 | return $value; |
194 | 209 | } |
195 | 210 | |
@@ -204,7 +219,8 @@ discard block |
||
204 | 219 | { |
205 | 220 | $parentClass = $this->reflection->getParentClass(); |
206 | 221 | |
207 | - if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) { |
|
222 | + if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) |
|
223 | + { |
|
208 | 224 | $parent = clone $this; |
209 | 225 | $parent->reflection = $this->getParentClass(); |
210 | 226 |
@@ -51,8 +51,10 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function injectDependencies(string $code, ClassNode $node, bool $removeTrait = false): string |
53 | 53 | { |
54 | - if (empty($node->dependencies)) { |
|
55 | - if ($removeTrait) { |
|
54 | + if (empty($node->dependencies)) |
|
55 | + { |
|
56 | + if ($removeTrait) |
|
57 | + { |
|
56 | 58 | $tr = new NodeTraverser(); |
57 | 59 | $tr->addVisitor(new RemoveUse()); |
58 | 60 | $tr->addVisitor(new RemoveTrait()); |
@@ -66,7 +68,8 @@ discard block |
||
66 | 68 | $tr = new NodeTraverser(); |
67 | 69 | $tr->addVisitor(new AddUse($node)); |
68 | 70 | |
69 | - if ($removeTrait) { |
|
71 | + if ($removeTrait) |
|
72 | + { |
|
70 | 73 | $tr->addVisitor(new RemoveUse()); |
71 | 74 | $tr->addVisitor(new RemoveTrait()); |
72 | 75 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct( |
29 | 29 | ?Lexer $lexer = null, |
30 | 30 | private readonly PrettyPrinterAbstract $printer = new Standard() |
31 | - ) { |
|
31 | + ){ |
|
32 | 32 | $this->lexer = $lexer ?? new Lexer\Emulative([ |
33 | 33 | 'usedAttributes' => [ |
34 | 34 | 'comments', |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function injectDependencies(string $code, ClassNode $node, bool $removeTrait = false): string |
53 | 53 | { |
54 | - if (empty($node->dependencies)) { |
|
55 | - if ($removeTrait) { |
|
54 | + if (empty($node->dependencies)){ |
|
55 | + if ($removeTrait){ |
|
56 | 56 | $tr = new NodeTraverser(); |
57 | 57 | $tr->addVisitor(new RemoveUse()); |
58 | 58 | $tr->addVisitor(new RemoveTrait()); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $tr = new NodeTraverser(); |
67 | 67 | $tr->addVisitor(new AddUse($node)); |
68 | 68 | |
69 | - if ($removeTrait) { |
|
69 | + if ($removeTrait){ |
|
70 | 70 | $tr->addVisitor(new RemoveUse()); |
71 | 71 | $tr->addVisitor(new RemoveTrait()); |
72 | 72 | } |