@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function parseDocComment() |
| 39 | 39 | { |
| 40 | - preg_match_all |
|
| 41 | - ( |
|
| 40 | + preg_match_all( |
|
| 42 | 41 | '/^' |
| 43 | 42 | . '[ \t]*\*[ \t]*' |
| 44 | 43 | . '@([a-zA-Z]+)' |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | |
| 56 | 55 | if (isset($this->acceptedParams[$name])) |
| 57 | 56 | { |
| 58 | - call_user_func |
|
| 59 | - ( |
|
| 57 | + call_user_func( |
|
| 60 | 58 | array($this, $this->acceptedParams[$name]), |
| 61 | 59 | $name, $value |
| 62 | 60 | ); |
@@ -66,7 +64,7 @@ discard block |
||
| 66 | 64 | |
| 67 | 65 | protected function setBool($name, $value) |
| 68 | 66 | { |
| 69 | - switch(strtolower($value)) |
|
| 67 | + switch (strtolower($value)) |
|
| 70 | 68 | { |
| 71 | 69 | case '': |
| 72 | 70 | case 'true': |
@@ -13,17 +13,15 @@ |
||
| 13 | 13 | |
| 14 | 14 | public static function fromName($class, $method) |
| 15 | 15 | { |
| 16 | - return new static(new PHPNativeReflectionMethod |
|
| 17 | - ( |
|
| 16 | + return new static(new PHPNativeReflectionMethod( |
|
| 18 | 17 | $class, $method |
| 19 | 18 | )); |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | - public function build(?ReflectionComposite $parent = null) |
|
| 21 | + public function build(? ReflectionComposite $parent = null) |
|
| 23 | 22 | { |
| 24 | 23 | $this->accessor->setRawValue('owner', $parent); |
| 25 | - $this->accessor->setRawValue |
|
| 26 | - ( |
|
| 24 | + $this->accessor->setRawValue( |
|
| 27 | 25 | 'name', |
| 28 | 26 | $this->reflector->getName() |
| 29 | 27 | ); |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | { |
| 29 | 29 | return |
| 30 | 30 | (is_object($value) ? spl_object_hash($value) |
| 31 | - : (is_array($value) ? implode($value) |
|
| 32 | - : ( (string)$value))); |
|
| 31 | + : (is_array($value) ? implode($value) |
|
| 32 | + : ((string)$value))); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function __construct($class, $property, $previous = null) |
| 10 | 10 | { |
| 11 | - parent::__construct |
|
| 12 | - ( |
|
| 11 | + parent::__construct( |
|
| 13 | 12 | 'Cannot ' . static::ACCESS_TYPE . ' non existent ' |
| 14 | 13 | . 'property: ' . $class . '::$' . $property, |
| 15 | 14 | 0, |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function setRawValue($key, $value) |
| 50 | 50 | { |
| 51 | - $this->getPropertyOrFail |
|
| 52 | - ( |
|
| 51 | + $this->getPropertyOrFail( |
|
| 53 | 52 | $key, |
| 54 | 53 | CannotWritePropertyException::class |
| 55 | 54 | ) |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | public function getRawValue($key) |
| 69 | 68 | { |
| 70 | 69 | return |
| 71 | - $this->getPropertyOrFail |
|
| 72 | - ( |
|
| 70 | + $this->getPropertyOrFail( |
|
| 73 | 71 | $key, |
| 74 | 72 | CannotReadPropertyException::class |
| 75 | 73 | ) |
@@ -86,8 +84,7 @@ discard block |
||
| 86 | 84 | */ |
| 87 | 85 | public function rawAddToValue($key, $value) |
| 88 | 86 | { |
| 89 | - $property = $this->getPropertyOrFail |
|
| 90 | - ( |
|
| 87 | + $property = $this->getPropertyOrFail( |
|
| 91 | 88 | $key, |
| 92 | 89 | CannotWritePropertyException::class |
| 93 | 90 | ); |
@@ -113,8 +110,7 @@ discard block |
||
| 113 | 110 | } |
| 114 | 111 | catch (ReflectionException $e) |
| 115 | 112 | { |
| 116 | - throw new $class |
|
| 117 | - ( |
|
| 113 | + throw new $class( |
|
| 118 | 114 | get_class($this->object), |
| 119 | 115 | $key, |
| 120 | 116 | $e |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | { |
| 25 | 25 | return |
| 26 | 26 | (is_object($value) ? spl_object_hash($value) |
| 27 | - : (is_array($value) ? implode($value) |
|
| 28 | - : ( (string)$value))); |
|
| 27 | + : (is_array($value) ? implode($value) |
|
| 28 | + : ((string)$value))); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function key() |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | case T_NAMESPACE: |
| 61 | 61 | $ns = new NamespaceBlock($classname); |
| 62 | 62 | $currentNS = new RawPropertyAccessor($ns); |
| 63 | - $this->accessor->getRawValue |
|
| 64 | - ( |
|
| 63 | + $this->accessor->getRawValue( |
|
| 65 | 64 | 'namespaces' |
| 66 | 65 | ) |
| 67 | 66 | ->add($classname, $ns); |
@@ -76,8 +75,7 @@ discard block |
||
| 76 | 75 | $as = end($as); |
| 77 | 76 | } |
| 78 | 77 | |
| 79 | - $currentNS->getRawValue |
|
| 80 | - ( |
|
| 78 | + $currentNS->getRawValue( |
|
| 81 | 79 | 'useStatements' |
| 82 | 80 | ) |
| 83 | 81 | ->add($as, new UseStatement($classname, $as)); |
@@ -103,6 +103,10 @@ |
||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + /** |
|
| 107 | + * @param string $name |
|
| 108 | + * @param \Closure $cast |
|
| 109 | + */ |
|
| 106 | 110 | private function setScalarValue($property, $value, $name, $cast) |
| 107 | 111 | { |
| 108 | 112 | $method = '__to' . $name; |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | if (!isset($args[$i])) |
| 49 | 49 | { |
| 50 | - throw new MissingRequiredParameterException |
|
| 51 | - ( |
|
| 50 | + throw new MissingRequiredParameterException( |
|
| 52 | 51 | get_class($this->object), |
| 53 | 52 | $property->name |
| 54 | 53 | ); |
@@ -109,14 +108,12 @@ discard block |
||
| 109 | 108 | { |
| 110 | 109 | if (!$this->reflect->properties->contains($property)) |
| 111 | 110 | { |
| 112 | - throw new CannotWritePropertyException |
|
| 113 | - ( |
|
| 111 | + throw new CannotWritePropertyException( |
|
| 114 | 112 | get_class($this->object), $property |
| 115 | 113 | ); |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | - $this->setAnyValue |
|
| 119 | - ( |
|
| 116 | + $this->setAnyValue( |
|
| 120 | 117 | $this->reflect->properties[$property], |
| 121 | 118 | $value |
| 122 | 119 | ); |
@@ -130,8 +127,7 @@ discard block |
||
| 130 | 127 | } |
| 131 | 128 | else |
| 132 | 129 | { |
| 133 | - $this->setNonNullValue |
|
| 134 | - ( |
|
| 130 | + $this->setNonNullValue( |
|
| 135 | 131 | $property->name, |
| 136 | 132 | $value, |
| 137 | 133 | $property->type |
@@ -198,8 +194,7 @@ discard block |
||
| 198 | 194 | } |
| 199 | 195 | elseif (is_object($value) && method_exists([$value, $method])) |
| 200 | 196 | { |
| 201 | - $this->setScalarValue |
|
| 202 | - ( |
|
| 197 | + $this->setScalarValue( |
|
| 203 | 198 | $property, |
| 204 | 199 | $value->$method(), |
| 205 | 200 | $method, |
@@ -238,8 +233,7 @@ discard block |
||
| 238 | 233 | |
| 239 | 234 | private function throwError($property, $expected, $value) |
| 240 | 235 | { |
| 241 | - throw new IllegalPropertyTypeException |
|
| 242 | - ( |
|
| 236 | + throw new IllegalPropertyTypeException( |
|
| 243 | 237 | get_class($this->object), |
| 244 | 238 | $property, |
| 245 | 239 | $expected, |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class IllegalPropertyTypeException extends Exception |
| 8 | 8 | { |
| 9 | - public function __construct |
|
| 10 | - ( |
|
| 9 | + public function __construct( |
|
| 11 | 10 | string $class, |
| 12 | 11 | string $property, |
| 13 | 12 | string $expected, |
@@ -15,10 +14,9 @@ discard block |
||
| 15 | 14 | Exception $previous = null |
| 16 | 15 | ) |
| 17 | 16 | { |
| 18 | - parent::__construct |
|
| 19 | - ( |
|
| 17 | + parent::__construct( |
|
| 20 | 18 | 'Tried to set an illegal property type for ' |
| 21 | - . $class .'::$' . $property . '. Excpected ' . $expected |
|
| 19 | + . $class . '::$' . $property . '. Excpected ' . $expected |
|
| 22 | 20 | . ', got ' . $got, |
| 23 | 21 | 0, |
| 24 | 22 | $previous |