@@ -225,6 +225,9 @@ |
||
| 225 | 225 | : new ObjectType($context); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | + /** |
|
| 229 | + * @param string $var |
|
| 230 | + */ |
|
| 228 | 231 | public function scalarToType($var) : ?AbstractType |
| 229 | 232 | { |
| 230 | 233 | switch (strtolower($var)) |
@@ -46,12 +46,10 @@ |
||
| 46 | 46 | ) |
| 47 | 47 | { |
| 48 | 48 | return true; |
| 49 | - } |
|
| 50 | - elseif ($parent instanceof ScalarType) |
|
| 49 | + } elseif ($parent instanceof ScalarType) |
|
| 51 | 50 | { |
| 52 | 51 | return get_class($parent) === get_class($child); |
| 53 | - } |
|
| 54 | - elseif ($parent instanceof ObjectType) |
|
| 52 | + } elseif ($parent instanceof ObjectType) |
|
| 55 | 53 | { |
| 56 | 54 | if |
| 57 | 55 | ( |
@@ -87,15 +87,13 @@ discard block |
||
| 87 | 87 | if ($building) |
| 88 | 88 | { |
| 89 | 89 | $this->buildProperty($property); |
| 90 | - } |
|
| 91 | - else |
|
| 90 | + } else |
|
| 92 | 91 | { |
| 93 | 92 | if (isset($args[$i])) |
| 94 | 93 | { |
| 95 | 94 | $this->setAnyValue($property, $args[$i]); |
| 96 | 95 | $i++; |
| 97 | - } |
|
| 98 | - else |
|
| 96 | + } else |
|
| 99 | 97 | { |
| 100 | 98 | $building = true; |
| 101 | 99 | $this->buildProperty($property); |
@@ -119,8 +117,7 @@ discard block |
||
| 119 | 117 | if (!$property->type instanceof ObjectType) |
| 120 | 118 | { |
| 121 | 119 | $this->setAnyValue($property, 0); |
| 122 | - } |
|
| 123 | - elseif ($property->builtInConstructor) |
|
| 120 | + } elseif ($property->builtInConstructor) |
|
| 124 | 121 | { |
| 125 | 122 | $class = (string)$property->type->classname; |
| 126 | 123 | $this->setRawValue($property->name, new $class()); |
@@ -175,12 +172,10 @@ discard block |
||
| 175 | 172 | if ($comparator->compatible($property->type, $valueType)) |
| 176 | 173 | { |
| 177 | 174 | $this->setRawValue($property->name, $value); |
| 178 | - } |
|
| 179 | - elseif ($property->type instanceof ScalarType) |
|
| 175 | + } elseif ($property->type instanceof ScalarType) |
|
| 180 | 176 | { |
| 181 | 177 | $this->setScalarValue($property, $valueType, $value); |
| 182 | - } |
|
| 183 | - else |
|
| 178 | + } else |
|
| 184 | 179 | { |
| 185 | 180 | $this->throwError($property, $valueType); |
| 186 | 181 | } |
@@ -209,8 +204,7 @@ discard block |
||
| 209 | 204 | $property->name, |
| 210 | 205 | $property->type->cast($value) |
| 211 | 206 | ); |
| 212 | - } |
|
| 213 | - elseif (is_object($value) && method_exists([$value, $method])) |
|
| 207 | + } elseif (is_object($value) && method_exists([$value, $method])) |
|
| 214 | 208 | { |
| 215 | 209 | $this->setScalarValue |
| 216 | 210 | ( |
@@ -218,8 +212,7 @@ discard block |
||
| 218 | 212 | $valueType, |
| 219 | 213 | $value->$method() |
| 220 | 214 | ); |
| 221 | - } |
|
| 222 | - else |
|
| 215 | + } else |
|
| 223 | 216 | { |
| 224 | 217 | $this->throwError($property, $valueType); |
| 225 | 218 | } |