@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | if (!static::$reflectionComposite) |
42 | 42 | { |
43 | 43 | static::$reflectionComposite = |
44 | - ReflectionCompositeFactory::fromClassName |
|
45 | - ( |
|
44 | + ReflectionCompositeFactory::fromClassName( |
|
46 | 45 | get_called_class() |
47 | 46 | ) |
48 | 47 | ->build(); |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | /** |
55 | 54 | * Set the default ReflectionComposite for this class |
56 | 55 | */ |
57 | - protected static function setDefaultReflectionComposite |
|
58 | - ( |
|
56 | + protected static function setDefaultReflectionComposite( |
|
59 | 57 | ReflectionComposite $defaultReflectionComposite |
60 | 58 | ) |
61 | 59 | { |
@@ -28,13 +28,11 @@ |
||
28 | 28 | * |
29 | 29 | * @param Throwable $previous The exception which caused this |
30 | 30 | */ |
31 | - public function __construct |
|
32 | - ( |
|
31 | + public function __construct( |
|
33 | 32 | Throwable $previous = null |
34 | 33 | ) |
35 | 34 | { |
36 | - parent::__construct |
|
37 | - ( |
|
35 | + parent::__construct( |
|
38 | 36 | 'Cannot serialize object containing generics without ' |
39 | 37 | . 'context', |
40 | 38 | 0, |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param ReflectionCompositeProviderInterface $default |
56 | 56 | */ |
57 | - public static function setDefault |
|
58 | - ( |
|
57 | + public static function setDefault( |
|
59 | 58 | ReflectionCompositeProviderInterface $default |
60 | 59 | ) |
61 | 60 | { |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | { |
91 | 90 | $this->cache[$classname] = |
92 | 91 | ( |
93 | - ReflectionCompositeFactory::fromClassName |
|
94 | - ( |
|
92 | + ReflectionCompositeFactory::fromClassName( |
|
95 | 93 | $classname |
96 | 94 | ) |
97 | 95 | ) |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | if (!isset($args[$i])) |
71 | 71 | { |
72 | - throw new MissingRequiredParameterException |
|
73 | - ( |
|
72 | + throw new MissingRequiredParameterException( |
|
74 | 73 | get_class($this->object), |
75 | 74 | $property->name |
76 | 75 | ); |
@@ -148,14 +147,12 @@ discard block |
||
148 | 147 | { |
149 | 148 | if (!$this->reflect->properties->containsKey($property)) |
150 | 149 | { |
151 | - throw new CannotWritePropertyException |
|
152 | - ( |
|
150 | + throw new CannotWritePropertyException( |
|
153 | 151 | get_class($this->object), $property |
154 | 152 | ); |
155 | 153 | } |
156 | 154 | |
157 | - $this->setAnyValue |
|
158 | - ( |
|
155 | + $this->setAnyValue( |
|
159 | 156 | $this->reflect->properties[$property], |
160 | 157 | $value |
161 | 158 | ); |
@@ -193,8 +190,7 @@ discard block |
||
193 | 190 | * @param ScalarType $valueType The scalar type |
194 | 191 | * @param mixed $value The value to set |
195 | 192 | */ |
196 | - private function setScalarValue |
|
197 | - ( |
|
193 | + private function setScalarValue( |
|
198 | 194 | ReflectionProperty $property, |
199 | 195 | ScalarType $valueType, |
200 | 196 | $value |
@@ -204,16 +200,14 @@ discard block |
||
204 | 200 | |
205 | 201 | if (is_scalar($value)) |
206 | 202 | { |
207 | - $this->setRawValue |
|
208 | - ( |
|
203 | + $this->setRawValue( |
|
209 | 204 | $property->name, |
210 | 205 | $property->type->cast($value) |
211 | 206 | ); |
212 | 207 | } |
213 | 208 | elseif (is_object($value) && method_exists([$value, $method])) |
214 | 209 | { |
215 | - $this->setScalarValue |
|
216 | - ( |
|
210 | + $this->setScalarValue( |
|
217 | 211 | $property, |
218 | 212 | $valueType, |
219 | 213 | $value->$method() |
@@ -231,14 +225,12 @@ discard block |
||
231 | 225 | * @param ReflectionProperty $property The property being set |
232 | 226 | * @param AbstractType $valueType The value being set |
233 | 227 | */ |
234 | - private function throwError |
|
235 | - ( |
|
228 | + private function throwError( |
|
236 | 229 | ReflectionProperty $property, |
237 | 230 | AbstractType $valueType |
238 | 231 | ) |
239 | 232 | { |
240 | - throw new IllegalPropertyTypeException |
|
241 | - ( |
|
233 | + throw new IllegalPropertyTypeException( |
|
242 | 234 | get_class($this->object), |
243 | 235 | $property->name, |
244 | 236 | $property->type, |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | return $this->inferGenericName($reflect); |
64 | 64 | } |
65 | 65 | |
66 | - throw new \DomainException |
|
67 | - ( |
|
66 | + throw new \DomainException( |
|
68 | 67 | 'Unknown type: ' . get_class($reflect) |
69 | 68 | ); |
70 | 69 | } |
@@ -101,8 +100,7 @@ discard block |
||
101 | 100 | $items[] = $this->inferName($generic); |
102 | 101 | } |
103 | 102 | |
104 | - return new ClassName |
|
105 | - ( |
|
103 | + return new ClassName( |
|
106 | 104 | self::BASE . $reflect->classname |
107 | 105 | . '_g' . implode('_c', $items) . '_e' |
108 | 106 | ); |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | * @param AbstractType $child |
36 | 36 | * @return boolean |
37 | 37 | */ |
38 | - public function compatible |
|
39 | - ( |
|
38 | + public function compatible( |
|
40 | 39 | AbstractType $parent, |
41 | 40 | AbstractType $child |
42 | 41 | ) |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | $parent = $this->getGenericType($parent); |
48 | 47 | } |
49 | 48 | |
50 | - if |
|
51 | - ( |
|
49 | + if ( |
|
52 | 50 | ($child instanceof NullType && $parent->nullable) || |
53 | 51 | ($parent instanceof MixedType) |
54 | 52 | ) |
@@ -61,11 +59,9 @@ discard block |
||
61 | 59 | } |
62 | 60 | elseif ($parent instanceof ObjectType) |
63 | 61 | { |
64 | - if |
|
65 | - ( |
|
62 | + if ( |
|
66 | 63 | $child instanceof ObjectType && |
67 | - is_a |
|
68 | - ( |
|
64 | + is_a( |
|
69 | 65 | $child->classname->__toString(), |
70 | 66 | $parent->classname->__toString(), |
71 | 67 | true |
@@ -74,8 +70,7 @@ discard block |
||
74 | 70 | { |
75 | 71 | foreach ($child->generics as $i => $generic) |
76 | 72 | { |
77 | - $compare = $this->compatible |
|
78 | - ( |
|
73 | + $compare = $this->compatible( |
|
79 | 74 | $parent->generics[$i], |
80 | 75 | $generic |
81 | 76 | ); |
@@ -92,8 +87,7 @@ discard block |
||
92 | 87 | return false; |
93 | 88 | } |
94 | 89 | |
95 | - throw new \DomainException |
|
96 | - ( |
|
90 | + throw new \DomainException( |
|
97 | 91 | 'Unknown type: ' . get_class($parent) |
98 | 92 | ); |
99 | 93 | } |
@@ -59,8 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | public function equals($type) : bool |
61 | 61 | { |
62 | - if |
|
63 | - ( |
|
62 | + if ( |
|
64 | 63 | $type instanceof ObjectType && |
65 | 64 | $type->classname->equals($this->classname) && |
66 | 65 | $type->generics->size() === $this->generics->size() |
@@ -44,8 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | if (!$pair instanceof OrderedPair) |
46 | 46 | { |
47 | - $pair = new OrderedPair |
|
48 | - ( |
|
47 | + $pair = new OrderedPair( |
|
49 | 48 | $this->size(), |
50 | 49 | $pair->key, |
51 | 50 | $pair->value |
@@ -73,8 +73,7 @@ |
||
73 | 73 | public function generateClassCode(...$generics) : string |
74 | 74 | { |
75 | 75 | $object = $this->createObject(...$generics); |
76 | - $this->nameProvider = new GenericNameProvider |
|
77 | - ( |
|
76 | + $this->nameProvider = new GenericNameProvider( |
|
78 | 77 | new GenericContext($object, $this->reflect) |
79 | 78 | ); |
80 | 79 | $class = $this->nameProvider->inferName($object); |