@@ -47,15 +47,13 @@ |
||
47 | 47 | * @param string $property The property accessed |
48 | 48 | * @param Throwable $previous The exception which caused this |
49 | 49 | */ |
50 | - public function __construct |
|
51 | - ( |
|
50 | + public function __construct( |
|
52 | 51 | string $class, |
53 | 52 | string $property, |
54 | 53 | Throwable $previous = null |
55 | 54 | ) |
56 | 55 | { |
57 | - parent::__construct |
|
58 | - ( |
|
56 | + parent::__construct( |
|
59 | 57 | 'Cannot ' . static::ACCESS_TYPE . ' property: ' |
60 | 58 | . $class . '::$' . $property . '. ' . static::ERROR_REASON, |
61 | 59 | 0, |
@@ -30,15 +30,13 @@ |
||
30 | 30 | * @param string $parameter The name of the missing parameter |
31 | 31 | * @param Throwable The exception which caused this |
32 | 32 | */ |
33 | - public function __construct |
|
34 | - ( |
|
33 | + public function __construct( |
|
35 | 34 | string $class, |
36 | 35 | string $parameter, |
37 | 36 | Throwable $previous = null |
38 | 37 | ) |
39 | 38 | { |
40 | - parent::__construct |
|
41 | - ( |
|
39 | + parent::__construct( |
|
42 | 40 | 'Missing required parameter in constructor. ' |
43 | 41 | . $class . ' requires a value for ' . $parameter, |
44 | 42 | 0, |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @param string $got The type that was provided |
33 | 33 | * @param Exception $previous The exception which caused this |
34 | 34 | */ |
35 | - public function __construct |
|
36 | - ( |
|
35 | + public function __construct( |
|
37 | 36 | string $class, |
38 | 37 | string $property, |
39 | 38 | string $expected, |
@@ -41,10 +40,9 @@ discard block |
||
41 | 40 | Exception $previous = null |
42 | 41 | ) |
43 | 42 | { |
44 | - parent::__construct |
|
45 | - ( |
|
43 | + parent::__construct( |
|
46 | 44 | 'Tried to set an illegal property type for ' |
47 | - . $class .'::$' . $property . '. Excpected ' . $expected |
|
45 | + . $class . '::$' . $property . '. Excpected ' . $expected |
|
48 | 46 | . ', got ' . $got, |
49 | 47 | 0, |
50 | 48 | $previous |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | if (!isset($args[$i])) |
67 | 67 | { |
68 | - throw new MissingRequiredParameterException |
|
69 | - ( |
|
68 | + throw new MissingRequiredParameterException( |
|
70 | 69 | get_class($this->object), |
71 | 70 | $property->name |
72 | 71 | ); |
@@ -144,14 +143,12 @@ discard block |
||
144 | 143 | { |
145 | 144 | if (!$this->reflect->properties->contains($property)) |
146 | 145 | { |
147 | - throw new CannotWritePropertyException |
|
148 | - ( |
|
146 | + throw new CannotWritePropertyException( |
|
149 | 147 | get_class($this->object), $property |
150 | 148 | ); |
151 | 149 | } |
152 | 150 | |
153 | - $this->setAnyValue |
|
154 | - ( |
|
151 | + $this->setAnyValue( |
|
155 | 152 | $this->reflect->properties[$property], |
156 | 153 | $value |
157 | 154 | ); |
@@ -198,8 +195,7 @@ discard block |
||
198 | 195 | * @param ReflectionProperty $property The property to set |
199 | 196 | * @param mixed $value The value to set |
200 | 197 | */ |
201 | - private function setNonNullValue |
|
202 | - ( |
|
198 | + private function setNonNullValue( |
|
203 | 199 | ReflectionProperty $property, |
204 | 200 | $value |
205 | 201 | ) |
@@ -248,8 +244,7 @@ discard block |
||
248 | 244 | * @param callable $cast Method to cast a value to the scalar data |
249 | 245 | * type |
250 | 246 | */ |
251 | - private function setScalarValue |
|
252 | - ( |
|
247 | + private function setScalarValue( |
|
253 | 248 | ReflectionProperty $property, |
254 | 249 | $value, |
255 | 250 | string $name, |
@@ -264,8 +259,7 @@ discard block |
||
264 | 259 | } |
265 | 260 | elseif (is_object($value) && method_exists([$value, $method])) |
266 | 261 | { |
267 | - $this->setScalarValue |
|
268 | - ( |
|
262 | + $this->setScalarValue( |
|
269 | 263 | $property, |
270 | 264 | $value->$method(), |
271 | 265 | $method, |
@@ -284,8 +278,7 @@ discard block |
||
284 | 278 | * @param ReflectionProperty $property The property to set |
285 | 279 | * @param mixed $value The value to set |
286 | 280 | */ |
287 | - private function setObjectValue |
|
288 | - ( |
|
281 | + private function setObjectValue( |
|
289 | 282 | ReflectionProperty $property, |
290 | 283 | $value |
291 | 284 | ) |
@@ -306,8 +299,7 @@ discard block |
||
306 | 299 | * @param ReflectionProperty $property The property to set |
307 | 300 | * @param mixed The value to set |
308 | 301 | */ |
309 | - private function setCollectionValue |
|
310 | - ( |
|
302 | + private function setCollectionValue( |
|
311 | 303 | ReflectionProperty $property, |
312 | 304 | $value |
313 | 305 | ) |
@@ -329,15 +321,13 @@ discard block |
||
329 | 321 | * @param string $expected The expected datatype |
330 | 322 | * @param string $value The value being set |
331 | 323 | */ |
332 | - private function throwError |
|
333 | - ( |
|
324 | + private function throwError( |
|
334 | 325 | ReflectionProperty $property, |
335 | 326 | string $expected, |
336 | 327 | $value |
337 | 328 | ) |
338 | 329 | { |
339 | - throw new IllegalPropertyTypeException |
|
340 | - ( |
|
330 | + throw new IllegalPropertyTypeException( |
|
341 | 331 | get_class($this->object), |
342 | 332 | $property->name, |
343 | 333 | $expected, |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function fromName(string $class, string $method) |
48 | 48 | { |
49 | - return new static(new PHPNativeReflectionMethod |
|
50 | - ( |
|
49 | + return new static(new PHPNativeReflectionMethod( |
|
51 | 50 | $class, $method |
52 | 51 | )); |
53 | 52 | } |
@@ -60,11 +59,10 @@ discard block |
||
60 | 59 | * this method belongs to |
61 | 60 | * @return ReflectionMethod |
62 | 61 | */ |
63 | - public function build(?ReflectionComposite $parent = null) |
|
62 | + public function build(? ReflectionComposite $parent = null) |
|
64 | 63 | { |
65 | 64 | $this->accessor->setRawValue('owner', $parent); |
66 | - $this->accessor->setRawValue |
|
67 | - ( |
|
65 | + $this->accessor->setRawValue( |
|
68 | 66 | 'name', |
69 | 67 | $this->reflector->getName() |
70 | 68 | ); |
@@ -61,13 +61,11 @@ discard block |
||
61 | 61 | (new ReflectionFileFactory($this->reflector->getFileName())) |
62 | 62 | ->build(); |
63 | 63 | $this->accessor->setRawValue('file', $file); |
64 | - $this->accessor->setRawValue |
|
65 | - ( |
|
64 | + $this->accessor->setRawValue( |
|
66 | 65 | 'classname', |
67 | 66 | $this->reflector->name |
68 | 67 | ); |
69 | - $this->accessor->setRawValue |
|
70 | - ( |
|
68 | + $this->accessor->setRawValue( |
|
71 | 69 | 'namespace', |
72 | 70 | $file->namespaces[$this->reflector->getNamespaceName()] |
73 | 71 | ); |
@@ -97,20 +95,17 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @param PHPNativeReflectionProperty |
99 | 97 | */ |
100 | - protected function buildProperty |
|
101 | - ( |
|
98 | + protected function buildProperty( |
|
102 | 99 | PHPNativeReflectionProperty $reflect |
103 | 100 | ) |
104 | 101 | { |
105 | - $properties = $this->accessor->getRawValue |
|
106 | - ( |
|
102 | + $properties = $this->accessor->getRawValue( |
|
107 | 103 | 'properties' |
108 | 104 | ); |
109 | 105 | |
110 | 106 | $properties[$reflect->getName()] = |
111 | 107 | (new ReflectionPropertyFactory($reflect)) |
112 | - ->build |
|
113 | - ( |
|
108 | + ->build( |
|
114 | 109 | $this->object, |
115 | 110 | $this->reflector |
116 | 111 | ->getDefaultProperties()[$reflect->getName()] |
@@ -125,8 +120,7 @@ discard block |
||
125 | 120 | */ |
126 | 121 | protected function buildMethod(PHPNativeReflectionMethod $reflect) |
127 | 122 | { |
128 | - $this->accessor->rawAddToValue |
|
129 | - ( |
|
123 | + $this->accessor->rawAddToValue( |
|
130 | 124 | 'methods', |
131 | 125 | (new ReflectionMethodFactory($reflect)) |
132 | 126 | ->build($this->object) |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function parseDocComment() |
73 | 73 | { |
74 | - preg_match_all |
|
75 | - ( |
|
74 | + preg_match_all( |
|
76 | 75 | '/^' |
77 | 76 | . '[ \t]*\*[ \t]*' |
78 | 77 | . '@([a-zA-Z]+)' |
@@ -89,8 +88,7 @@ discard block |
||
89 | 88 | |
90 | 89 | if (isset($this->acceptedParams[$name])) |
91 | 90 | { |
92 | - call_user_func |
|
93 | - ( |
|
91 | + call_user_func( |
|
94 | 92 | array($this, $this->acceptedParams[$name]), |
95 | 93 | $name, $value |
96 | 94 | ); |
@@ -106,7 +104,7 @@ discard block |
||
106 | 104 | */ |
107 | 105 | protected function setBool($name, $value) |
108 | 106 | { |
109 | - switch(strtolower($value)) |
|
107 | + switch (strtolower($value)) |
|
110 | 108 | { |
111 | 109 | case '': |
112 | 110 | case 'true': |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function fromName($class, $property) |
66 | 66 | { |
67 | - return new static(new PHPNativeReflectionProperty |
|
68 | - ( |
|
67 | + return new static(new PHPNativeReflectionProperty( |
|
69 | 68 | $class, $property |
70 | 69 | )); |
71 | 70 | } |
@@ -83,8 +82,7 @@ discard block |
||
83 | 82 | { |
84 | 83 | $this->accessor->setRawValue('owner', $parent); |
85 | 84 | $this->accessor->setRawValue('defaultValue', $default); |
86 | - $this->accessor->setRawValue |
|
87 | - ( |
|
85 | + $this->accessor->setRawValue( |
|
88 | 86 | 'name', |
89 | 87 | $this->reflector->getName() |
90 | 88 | ); |
@@ -189,50 +187,42 @@ discard block |
||
189 | 187 | switch ($value[0]) |
190 | 188 | { |
191 | 189 | case 'required': |
192 | - $this->accessor->setRawValue |
|
193 | - ( |
|
190 | + $this->accessor->setRawValue( |
|
194 | 191 | 'passedToConstructor', |
195 | 192 | true |
196 | 193 | ); |
197 | - $this->accessor->setRawValue |
|
198 | - ( |
|
194 | + $this->accessor->setRawValue( |
|
199 | 195 | 'requiredInConstructor', |
200 | 196 | true |
201 | 197 | ); |
202 | - $compositeAccessor->rawAddToValue |
|
203 | - ( |
|
198 | + $compositeAccessor->rawAddToValue( |
|
204 | 199 | 'requiredProperties', |
205 | 200 | $this->object |
206 | 201 | ); |
207 | 202 | break; |
208 | 203 | case 'new': |
209 | - $this->accessor->setRawValue |
|
210 | - ( |
|
204 | + $this->accessor->setRawValue( |
|
211 | 205 | 'builtInConstructor', |
212 | 206 | true |
213 | 207 | ); |
214 | - $compositeAccessor->rawAddToValue |
|
215 | - ( |
|
208 | + $compositeAccessor->rawAddToValue( |
|
216 | 209 | 'builtProperties', |
217 | 210 | $this->object |
218 | 211 | ); |
219 | 212 | break; |
220 | 213 | case 'optional': |
221 | - $this->accessor->setRawValue |
|
222 | - ( |
|
214 | + $this->accessor->setRawValue( |
|
223 | 215 | 'passedToConstructor', |
224 | 216 | true |
225 | 217 | ); |
226 | - $compositeAccessor->rawAddToValue |
|
227 | - ( |
|
218 | + $compositeAccessor->rawAddToValue( |
|
228 | 219 | 'optionalProperties', |
229 | 220 | $this->object |
230 | 221 | ); |
231 | 222 | |
232 | 223 | if (isset($value[1]) && $value[1] === 'new') |
233 | 224 | { |
234 | - $this->accessor->setRawValue |
|
235 | - ( |
|
225 | + $this->accessor->setRawValue( |
|
236 | 226 | 'builtInConstructor', |
237 | 227 | true |
238 | 228 | ); |