@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function supports(\ReflectionNamedType $type): bool |
17 | 17 | { |
18 | - if ($this->interfaceExists === null) { |
|
18 | + if ($this->interfaceExists === null){ |
|
19 | 19 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
20 | 20 | } |
21 | 21 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void |
26 | 26 | { |
27 | - try { |
|
27 | + try{ |
|
28 | 28 | $property->setValue($filter, $value instanceof UuidInterface ? $value : Uuid::fromString($value)); |
29 | - } catch (\Throwable $e) { |
|
29 | + }catch (\Throwable $e){ |
|
30 | 30 | throw new SetterException( |
31 | 31 | previous: $e, |
32 | 32 | message: \sprintf('Unable to set UUID value. %s', $e->getMessage()), |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | |
37 | 37 | private function implements(string $haystack, string $interface): bool |
38 | 38 | { |
39 | - if ($haystack === $interface) { |
|
39 | + if ($haystack === $interface){ |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | |
43 | - if (!\class_exists($haystack)) { |
|
43 | + if (!\class_exists($haystack)){ |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
48 | - if ($implements === $interface) { |
|
47 | + foreach ((array)\class_implements($haystack) as $implements){ |
|
48 | + if ($implements === $interface){ |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
52 | - if (self::implements($implements, $interface)) { |
|
52 | + if (self::implements($implements, $interface)){ |
|
53 | 53 | return true; |
54 | 54 | } |
55 | 55 | } |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function supports(\ReflectionNamedType $type): bool |
17 | 17 | { |
18 | - if ($this->interfaceExists === null) { |
|
18 | + if ($this->interfaceExists === null) |
|
19 | + { |
|
19 | 20 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
20 | 21 | } |
21 | 22 | |
@@ -24,9 +25,12 @@ discard block |
||
24 | 25 | |
25 | 26 | public function setValue(FilterInterface $filter, \ReflectionProperty $property, mixed $value): void |
26 | 27 | { |
27 | - try { |
|
28 | + try |
|
29 | + { |
|
28 | 30 | $property->setValue($filter, $value instanceof UuidInterface ? $value : Uuid::fromString($value)); |
29 | - } catch (\Throwable $e) { |
|
31 | + } |
|
32 | + catch (\Throwable $e) |
|
33 | + { |
|
30 | 34 | throw new SetterException( |
31 | 35 | previous: $e, |
32 | 36 | message: \sprintf('Unable to set UUID value. %s', $e->getMessage()), |
@@ -36,20 +40,25 @@ discard block |
||
36 | 40 | |
37 | 41 | private function implements(string $haystack, string $interface): bool |
38 | 42 | { |
39 | - if ($haystack === $interface) { |
|
43 | + if ($haystack === $interface) |
|
44 | + { |
|
40 | 45 | return true; |
41 | 46 | } |
42 | 47 | |
43 | - if (!\class_exists($haystack)) { |
|
48 | + if (!\class_exists($haystack)) |
|
49 | + { |
|
44 | 50 | return false; |
45 | 51 | } |
46 | 52 | |
47 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
48 | - if ($implements === $interface) { |
|
53 | + foreach ((array)\class_implements($haystack) as $implements) |
|
54 | + { |
|
55 | + if ($implements === $interface) |
|
56 | + { |
|
49 | 57 | return true; |
50 | 58 | } |
51 | 59 | |
52 | - if (self::implements($implements, $interface)) { |
|
60 | + if (self::implements($implements, $interface)) |
|
61 | + { |
|
53 | 62 | return true; |
54 | 63 | } |
55 | 64 | } |