@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function __construct( |
27 | 27 | public readonly string $property |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | } |
30 | 30 | } |
@@ -85,7 +85,7 @@ |
||
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 |
@@ -85,7 +85,8 @@ |
||
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 |
@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 |
@@ -28,7 +28,8 @@ |
||
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 |
@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -48,7 +48,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -19,8 +19,8 @@ |
||
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) |
@@ -19,8 +19,10 @@ |
||
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) |
@@ -8,10 +8,10 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private readonly Tokenizer $tokenizer |
11 | - ) { |
|
11 | + ){ |
|
12 | 12 | } |
13 | 13 | |
14 | - public function getScopedClasses(string $scope, object|string|null $target = null): array |
|
14 | + public function getScopedClasses(string $scope, object | string | null $target = null): array |
|
15 | 15 | { |
16 | 16 | return $this->tokenizer->scopedClassLocator($scope)->getClasses($target); |
17 | 17 | } |
@@ -21,5 +21,5 @@ |
||
21 | 21 | * results. |
22 | 22 | * @return array<class-string, ReflectionClass> |
23 | 23 | */ |
24 | - public function getClasses(object|string|null $target = null): array; |
|
24 | + public function getClasses(object | string | null $target = null): array; |
|
25 | 25 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | { |
17 | 17 | $traits = []; |
18 | 18 | |
19 | - do { |
|
19 | + do{ |
|
20 | 20 | $traits = \array_merge(\class_uses($class), $traits); |
21 | 21 | $class = \get_parent_class($class); |
22 | - } while ($class !== false); |
|
22 | + }while ($class !== false); |
|
23 | 23 | |
24 | 24 | //Traits from traits |
25 | - foreach (\array_flip($traits) as $trait) { |
|
25 | + foreach (\array_flip($traits) as $trait){ |
|
26 | 26 | $traits = \array_merge(\class_uses($trait), $traits); |
27 | 27 | } |
28 | 28 |
@@ -16,13 +16,15 @@ |
||
16 | 16 | { |
17 | 17 | $traits = []; |
18 | 18 | |
19 | - do { |
|
19 | + do |
|
20 | + { |
|
20 | 21 | $traits = \array_merge(\class_uses($class), $traits); |
21 | 22 | $class = \get_parent_class($class); |
22 | 23 | } while ($class !== false); |
23 | 24 | |
24 | 25 | //Traits from traits |
25 | - foreach (\array_flip($traits) as $trait) { |
|
26 | + foreach (\array_flip($traits) as $trait) |
|
27 | + { |
|
26 | 28 | $traits = \array_merge(\class_uses($trait), $traits); |
27 | 29 | } |
28 | 30 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | public function getInvocations(\ReflectionFunctionAbstract $function): array |
22 | 22 | { |
23 | 23 | $result = []; |
24 | - foreach ($this->availableInvocations($function->getName()) as $invocation) { |
|
25 | - if ($this->isTargeted($invocation, $function)) { |
|
24 | + foreach ($this->availableInvocations($function->getName()) as $invocation){ |
|
25 | + if ($this->isTargeted($invocation, $function)){ |
|
26 | 26 | $result[] = $invocation; |
27 | 27 | } |
28 | 28 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | protected function availableInvocations(string $signature = ''): \Generator |
40 | 40 | { |
41 | 41 | $signature = \strtolower(\trim($signature, '\\')); |
42 | - foreach ($this->availableReflections() as $reflection) { |
|
43 | - foreach ($reflection->getInvocations() as $invocation) { |
|
42 | + foreach ($this->availableReflections() as $reflection){ |
|
43 | + foreach ($reflection->getInvocations() as $invocation){ |
|
44 | 44 | if ( |
45 | 45 | !empty($signature) |
46 | 46 | && \strtolower(\trim($invocation->getName(), '\\')) !== $signature |
47 | - ) { |
|
47 | + ){ |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | |
56 | 56 | protected function isTargeted(ReflectionInvocation $invocation, \ReflectionFunctionAbstract $function): bool |
57 | 57 | { |
58 | - if ($function instanceof \ReflectionFunction) { |
|
58 | + if ($function instanceof \ReflectionFunction){ |
|
59 | 59 | return !$invocation->isMethod(); |
60 | 60 | } |
61 | 61 | |
62 | - try { |
|
62 | + try{ |
|
63 | 63 | $reflection = $this->classReflection($invocation->getClass()); |
64 | - } catch (LocatorException $e) { |
|
65 | - if ($this->debug) { |
|
64 | + }catch (LocatorException $e){ |
|
65 | + if ($this->debug){ |
|
66 | 66 | throw $e; |
67 | 67 | } |
68 | 68 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | $target = $function->getDeclaringClass(); |
76 | 76 | |
77 | - if ($target->isTrait()) { |
|
77 | + if ($target->isTrait()){ |
|
78 | 78 | //Let's compare traits |
79 | 79 | return \in_array($target->getName(), $this->fetchTraits($invocation->getClass())); |
80 | 80 | } |
@@ -21,8 +21,10 @@ discard block |
||
21 | 21 | public function getInvocations(\ReflectionFunctionAbstract $function): array |
22 | 22 | { |
23 | 23 | $result = []; |
24 | - foreach ($this->availableInvocations($function->getName()) as $invocation) { |
|
25 | - if ($this->isTargeted($invocation, $function)) { |
|
24 | + foreach ($this->availableInvocations($function->getName()) as $invocation) |
|
25 | + { |
|
26 | + if ($this->isTargeted($invocation, $function)) |
|
27 | + { |
|
26 | 28 | $result[] = $invocation; |
27 | 29 | } |
28 | 30 | } |
@@ -39,8 +41,10 @@ discard block |
||
39 | 41 | protected function availableInvocations(string $signature = ''): \Generator |
40 | 42 | { |
41 | 43 | $signature = \strtolower(\trim($signature, '\\')); |
42 | - foreach ($this->availableReflections() as $reflection) { |
|
43 | - foreach ($reflection->getInvocations() as $invocation) { |
|
44 | + foreach ($this->availableReflections() as $reflection) |
|
45 | + { |
|
46 | + foreach ($reflection->getInvocations() as $invocation) |
|
47 | + { |
|
44 | 48 | if ( |
45 | 49 | !empty($signature) |
46 | 50 | && \strtolower(\trim($invocation->getName(), '\\')) !== $signature |
@@ -55,14 +59,19 @@ discard block |
||
55 | 59 | |
56 | 60 | protected function isTargeted(ReflectionInvocation $invocation, \ReflectionFunctionAbstract $function): bool |
57 | 61 | { |
58 | - if ($function instanceof \ReflectionFunction) { |
|
62 | + if ($function instanceof \ReflectionFunction) |
|
63 | + { |
|
59 | 64 | return !$invocation->isMethod(); |
60 | 65 | } |
61 | 66 | |
62 | - try { |
|
67 | + try |
|
68 | + { |
|
63 | 69 | $reflection = $this->classReflection($invocation->getClass()); |
64 | - } catch (LocatorException $e) { |
|
65 | - if ($this->debug) { |
|
70 | + } |
|
71 | + catch (LocatorException $e) |
|
72 | + { |
|
73 | + if ($this->debug) |
|
74 | + { |
|
66 | 75 | throw $e; |
67 | 76 | } |
68 | 77 | |
@@ -74,7 +83,8 @@ discard block |
||
74 | 83 | */ |
75 | 84 | $target = $function->getDeclaringClass(); |
76 | 85 | |
77 | - if ($target->isTrait()) { |
|
86 | + if ($target->isTrait()) |
|
87 | + { |
|
78 | 88 | //Let's compare traits |
79 | 89 | return \in_array($target->getName(), $this->fetchTraits($invocation->getClass())); |
80 | 90 | } |