@@ -110,8 +110,7 @@ |
||
| 110 | 110 | $prop->setAccessible(true); |
| 111 | 111 | |
| 112 | 112 | return $prop; |
| 113 | - } |
|
| 114 | - catch (ReflectionException $e) |
|
| 113 | + } catch (ReflectionException $e) |
|
| 115 | 114 | { |
| 116 | 115 | throw new $class |
| 117 | 116 | ( |
@@ -93,8 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $as .= $token[1]; |
| 95 | 95 | } |
| 96 | - } |
|
| 97 | - elseif ($matching) |
|
| 96 | + } elseif ($matching) |
|
| 98 | 97 | { |
| 99 | 98 | switch ($token[0]) |
| 100 | 99 | { |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | case T_AS: |
| 106 | 105 | $matching = T_AS; |
| 107 | 106 | } |
| 108 | - } |
|
| 109 | - else |
|
| 107 | + } else |
|
| 110 | 108 | { |
| 111 | 109 | switch ($token[0]) |
| 112 | 110 | { |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | if ($property->writable) |
| 13 | 13 | { |
| 14 | 14 | parent::setAnyValue($property, $value); |
| 15 | - } |
|
| 16 | - else |
|
| 15 | + } else |
|
| 17 | 16 | { |
| 18 | 17 | throw new PropertyNotWritableException |
| 19 | 18 | ( |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | get_class($this->object), |
| 33 | 32 | $property |
| 34 | 33 | ); |
| 35 | - } |
|
| 36 | - elseif (!$this->reflect->properties[$property]->readable) |
|
| 34 | + } elseif (!$this->reflect->properties[$property]->readable) |
|
| 37 | 35 | { |
| 38 | 36 | throw new PropertyNotReadableException |
| 39 | 37 | ( |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | * Builds the ReflectionProperty from the provided parameters, |
| 75 | 75 | * linking to a parent ReflectionComposite |
| 76 | 76 | * |
| 77 | - * @param ReflectionCompostite $parent The reflector for the class |
|
| 77 | + * @param ReflectionComposite $parent The reflector for the class |
|
| 78 | 78 | * this property belongs to |
| 79 | 79 | * @param mixed $default This property's default value |
| 80 | 80 | * @return ReflectionProperty |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | /** |
| 33 | 33 | * Creates this ObjectType with the given classname |
| 34 | 34 | * |
| 35 | - * @param string $class The name of the class this must be an |
|
| 35 | + * @param string $classname The name of the class this must be an |
|
| 36 | 36 | * instance of |
| 37 | 37 | */ |
| 38 | 38 | public function __construct(string $classname) |
@@ -83,15 +83,13 @@ discard block |
||
| 83 | 83 | if ($building) |
| 84 | 84 | { |
| 85 | 85 | $this->buildProperty($property); |
| 86 | - } |
|
| 87 | - else |
|
| 86 | + } else |
|
| 88 | 87 | { |
| 89 | 88 | if (isset($args[$i])) |
| 90 | 89 | { |
| 91 | 90 | $this->setAnyValue($property, $args[$i]); |
| 92 | 91 | $i++; |
| 93 | - } |
|
| 94 | - else |
|
| 92 | + } else |
|
| 95 | 93 | { |
| 96 | 94 | $building = true; |
| 97 | 95 | $this->buildProperty($property); |
@@ -116,8 +114,7 @@ discard block |
||
| 116 | 114 | { |
| 117 | 115 | $class = $property->type->classname; |
| 118 | 116 | $this->setRawValue($property->name, new $class()); |
| 119 | - } |
|
| 120 | - else |
|
| 117 | + } else |
|
| 121 | 118 | { |
| 122 | 119 | $this->setAnyValue($property, 0); |
| 123 | 120 | } |
@@ -168,8 +165,7 @@ discard block |
||
| 168 | 165 | if (is_null($value)) |
| 169 | 166 | { |
| 170 | 167 | $this->setNullValue($property); |
| 171 | - } |
|
| 172 | - else |
|
| 168 | + } else |
|
| 173 | 169 | { |
| 174 | 170 | $this->setNonNullValue($property, $value); |
| 175 | 171 | } |
@@ -185,8 +181,7 @@ discard block |
||
| 185 | 181 | if ($property->type->nullable) |
| 186 | 182 | { |
| 187 | 183 | $this->setRawValue($property->name, null); |
| 188 | - } |
|
| 189 | - else |
|
| 184 | + } else |
|
| 190 | 185 | { |
| 191 | 186 | $this->throwError($property, 'NonNull', null); |
| 192 | 187 | } |
@@ -261,8 +256,7 @@ discard block |
||
| 261 | 256 | if (is_scalar($value)) |
| 262 | 257 | { |
| 263 | 258 | $this->setRawValue($property->name, $cast($value)); |
| 264 | - } |
|
| 265 | - elseif (is_object($value) && method_exists([$value, $method])) |
|
| 259 | + } elseif (is_object($value) && method_exists([$value, $method])) |
|
| 266 | 260 | { |
| 267 | 261 | $this->setScalarValue |
| 268 | 262 | ( |
@@ -271,8 +265,7 @@ discard block |
||
| 271 | 265 | $method, |
| 272 | 266 | $cast |
| 273 | 267 | ); |
| 274 | - } |
|
| 275 | - else |
|
| 268 | + } else |
|
| 276 | 269 | { |
| 277 | 270 | $this->throwError($property, $name, $value); |
| 278 | 271 | } |
@@ -293,8 +286,7 @@ discard block |
||
| 293 | 286 | if (is_a($value, $property->type->classname)) |
| 294 | 287 | { |
| 295 | 288 | $this->setRawValue($property->name, $value); |
| 296 | - } |
|
| 297 | - else |
|
| 289 | + } else |
|
| 298 | 290 | { |
| 299 | 291 | $this->throwError |
| 300 | 292 | ( |
@@ -320,8 +312,7 @@ discard block |
||
| 320 | 312 | if (is_a($value, \ArrayAccess::class) || is_array($value)) |
| 321 | 313 | { |
| 322 | 314 | $this->setRawValue($property->name, $value); |
| 323 | - } |
|
| 324 | - else |
|
| 315 | + } else |
|
| 325 | 316 | { |
| 326 | 317 | $this->throwError($property, 'Collection', $value); |
| 327 | 318 | } |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | if ($offset === null) |
| 30 | 30 | { |
| 31 | 31 | $this->add($value); |
| 32 | - } |
|
| 33 | - else |
|
| 32 | + } else |
|
| 34 | 33 | { |
| 35 | 34 | $this->set($offset, $value); |
| 36 | 35 | } |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | * |
| 131 | 131 | * @param string $name |
| 132 | 132 | * @param bool $checkFile |
| 133 | - * @param string $singular |
|
| 133 | + * @param string $signular |
|
| 134 | 134 | */ |
| 135 | 135 | protected function addItems |
| 136 | 136 | ( |
@@ -174,8 +174,7 @@ |
||
| 174 | 174 | { |
| 175 | 175 | $key = $value; |
| 176 | 176 | $type = ''; |
| 177 | - } |
|
| 178 | - else |
|
| 177 | + } else |
|
| 179 | 178 | { |
| 180 | 179 | $key = substr($value, 0, $space); |
| 181 | 180 | $type = substr($value, $space); |
@@ -47,6 +47,9 @@ discard block |
||
| 47 | 47 | return $this->innerParse($value); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $value |
|
| 52 | + */ |
|
| 50 | 53 | protected function innerParse($value) |
| 51 | 54 | { |
| 52 | 55 | $nullable = false; |
@@ -120,6 +123,9 @@ discard block |
||
| 120 | 123 | return $this->resolveName($current, $nullable, $collection); |
| 121 | 124 | } |
| 122 | 125 | |
| 126 | + /** |
|
| 127 | + * @param integer $i |
|
| 128 | + */ |
|
| 123 | 129 | protected function checkCollectionClose($value, $i) |
| 124 | 130 | { |
| 125 | 131 | if ($i + 1 === strlen($value)) |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | if ($stack->isEmpty()) |
| 111 | 111 | { |
| 112 | 112 | return $item; |
| 113 | - } |
|
| 114 | - else |
|
| 113 | + } else |
|
| 115 | 114 | { |
| 116 | 115 | $stack->top()->generics[] = $item; |
| 117 | 116 | } |
@@ -129,12 +128,10 @@ discard block |
||
| 129 | 128 | if ($i + 1 === strlen($value)) |
| 130 | 129 | { |
| 131 | 130 | throw new \Exception('Unexpected EOF'); |
| 132 | - } |
|
| 133 | - elseif ($value{$i + 1} !== ']') |
|
| 131 | + } elseif ($value{$i + 1} !== ']') |
|
| 134 | 132 | { |
| 135 | 133 | throw new \Exception('[ must be followed by ]'); |
| 136 | - } |
|
| 137 | - elseif ($i + 2 !== strlen($value)) |
|
| 134 | + } elseif ($i + 2 !== strlen($value)) |
|
| 138 | 135 | { |
| 139 | 136 | if (!in_array($value{$i + 2}, ['>',','])) |
| 140 | 137 | { |
@@ -194,12 +191,10 @@ discard block |
||
| 194 | 191 | if ($useStatements->containsKey($value)) |
| 195 | 192 | { |
| 196 | 193 | $value = $useStatements[$value]->classname; |
| 197 | - } |
|
| 198 | - elseif ($generics->containsKey($value)) |
|
| 194 | + } elseif ($generics->containsKey($value)) |
|
| 199 | 195 | { |
| 200 | 196 | $value = new GenericType($value); |
| 201 | - } |
|
| 202 | - else |
|
| 197 | + } else |
|
| 203 | 198 | { |
| 204 | 199 | $value = $this->context->namespace->namespace |
| 205 | 200 | . '\\' . $value; |