@@ -45,10 +45,9 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * {@inheritDoc} |
| 47 | 47 | */ |
| 48 | - public function splice |
|
| 49 | - ( |
|
| 48 | + public function splice( |
|
| 50 | 49 | int $offset, |
| 51 | - ?int $length = null, |
|
| 50 | + ? int $length = null, |
|
| 52 | 51 | array $replacement = [] |
| 53 | 52 | ) |
| 54 | 53 | { |
@@ -33,10 +33,9 @@ |
||
| 33 | 33 | * @param int $length The number of elements to remove |
| 34 | 34 | * @param array $items Items to add |
| 35 | 35 | */ |
| 36 | - public function splice |
|
| 37 | - ( |
|
| 36 | + public function splice( |
|
| 38 | 37 | int $offset, |
| 39 | - ?int$length = null, |
|
| 38 | + ? int$length = null, |
|
| 40 | 39 | array $items = [] |
| 41 | 40 | ); |
| 42 | 41 | |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | return static::$defaultHashProducer; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static function setDefaultHashProducer |
|
| 45 | - ( |
|
| 44 | + public static function setDefaultHashProducer( |
|
| 46 | 45 | HashProducerInterface $hashProducer |
| 47 | 46 | ) |
| 48 | 47 | : HashProducerInterface |
@@ -60,9 +59,8 @@ discard block |
||
| 60 | 59 | */ |
| 61 | 60 | protected $hashProducer; |
| 62 | 61 | |
| 63 | - public function __construct |
|
| 64 | - ( |
|
| 65 | - ?HashProducerInterface $hashProducer = null |
|
| 62 | + public function __construct( |
|
| 63 | + ? HashProducerInterface $hashProducer = null |
|
| 66 | 64 | ) |
| 67 | 65 | { |
| 68 | 66 | $this->hashProducer = |
@@ -45,10 +45,9 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * {@inheritDoc} |
| 47 | 47 | */ |
| 48 | - public function splice |
|
| 49 | - ( |
|
| 48 | + public function splice( |
|
| 50 | 49 | int $offset, |
| 51 | - ?int $length = null, |
|
| 50 | + ? int $length = null, |
|
| 52 | 51 | array $replacement = [] |
| 53 | 52 | ) |
| 54 | 53 | { |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | return static::$default; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public static function setDefault |
|
| 43 | - ( |
|
| 42 | + public static function setDefault( |
|
| 44 | 43 | ReflectionCompositeProviderInterface $default |
| 45 | 44 | ) |
| 46 | 45 | { |
@@ -60,8 +59,7 @@ discard block |
||
| 60 | 59 | { |
| 61 | 60 | $this->cache[$classname] = |
| 62 | 61 | ( |
| 63 | - ReflectionCompositeFactory::fromClassName |
|
| 64 | - ( |
|
| 62 | + ReflectionCompositeFactory::fromClassName( |
|
| 65 | 63 | $classname |
| 66 | 64 | ) |
| 67 | 65 | ) |
@@ -78,8 +78,7 @@ discard block |
||
| 78 | 78 | * @param PHPNativeReflectionClass $reflect |
| 79 | 79 | * @param ReflectionCompositeProviderInterface $provider |
| 80 | 80 | */ |
| 81 | - public function __construct |
|
| 82 | - ( |
|
| 81 | + public function __construct( |
|
| 83 | 82 | PHPNativeReflectionClass $reflect, |
| 84 | 83 | ReflectionCompositeProviderInterface $provider |
| 85 | 84 | ) |
@@ -117,13 +116,11 @@ discard block |
||
| 117 | 116 | $file = (new ReflectionFileFactory($fileName))->build(); |
| 118 | 117 | $this->accessor->setRawValue('file', $file); |
| 119 | 118 | |
| 120 | - $this->accessor->setRawValue |
|
| 121 | - ( |
|
| 119 | + $this->accessor->setRawValue( |
|
| 122 | 120 | 'classname', |
| 123 | 121 | $this->reflector->name |
| 124 | 122 | ); |
| 125 | - $this->accessor->setRawValue |
|
| 126 | - ( |
|
| 123 | + $this->accessor->setRawValue( |
|
| 127 | 124 | 'namespace', |
| 128 | 125 | $file->namespaces[$this->reflector->getNamespaceName()] |
| 129 | 126 | ); |
@@ -146,8 +143,7 @@ discard block |
||
| 146 | 143 | $size = count($this->reflector->{'get' . $name}()); |
| 147 | 144 | foreach ($prefixes as $prefix) |
| 148 | 145 | { |
| 149 | - $this->accessor->setRawValue |
|
| 150 | - ( |
|
| 146 | + $this->accessor->setRawValue( |
|
| 151 | 147 | $prefix . $name, |
| 152 | 148 | new FixedList($size) |
| 153 | 149 | ); |
@@ -177,8 +173,7 @@ discard block |
||
| 177 | 173 | * @param bool $checkFile |
| 178 | 174 | * @param string $singular |
| 179 | 175 | */ |
| 180 | - protected function addItems |
|
| 181 | - ( |
|
| 176 | + protected function addItems( |
|
| 182 | 177 | string $name, |
| 183 | 178 | bool $checkFile, |
| 184 | 179 | string $signular |
@@ -209,8 +204,7 @@ discard block |
||
| 209 | 204 | new $factory($item), |
| 210 | 205 | $item |
| 211 | 206 | ); |
| 212 | - $this->accessor->rawAddToValue |
|
| 213 | - ( |
|
| 207 | + $this->accessor->rawAddToValue( |
|
| 214 | 208 | 'local' . ucfirst($name), |
| 215 | 209 | $item |
| 216 | 210 | ); |
@@ -227,8 +221,7 @@ discard block |
||
| 227 | 221 | * @param PHPNativeReflectionClass $reflect |
| 228 | 222 | * @param string $method |
| 229 | 223 | */ |
| 230 | - protected function addInheritance |
|
| 231 | - ( |
|
| 224 | + protected function addInheritance( |
|
| 232 | 225 | string $group, |
| 233 | 226 | PHPNativeReflectionClass $reflect, |
| 234 | 227 | string $method = 'rawAddToValue' |
@@ -248,15 +241,13 @@ discard block |
||
| 248 | 241 | * @param ReflectionPropertyFactory $factory |
| 249 | 242 | * @return ReflectionProperty |
| 250 | 243 | */ |
| 251 | - protected function buildProperty |
|
| 252 | - ( |
|
| 244 | + protected function buildProperty( |
|
| 253 | 245 | ReflectionPropertyFactory $factory, |
| 254 | 246 | PHPNativeReflectionProperty $reflect |
| 255 | 247 | ) |
| 256 | 248 | : ReflectionProperty |
| 257 | 249 | { |
| 258 | - return $factory->build |
|
| 259 | - ( |
|
| 250 | + return $factory->build( |
|
| 260 | 251 | $this->object, |
| 261 | 252 | $this->reflector |
| 262 | 253 | ->getDefaultProperties()[$reflect->getName()] |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected function parseDocComment(array $acceptedParams) |
| 65 | 65 | { |
| 66 | - preg_match_all |
|
| 67 | - ( |
|
| 66 | + preg_match_all( |
|
| 68 | 67 | '/^' |
| 69 | 68 | . '[ \t]*\*[ \t]*' |
| 70 | 69 | . '@([a-zA-Z]+)' |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | |
| 82 | 81 | if (isset($acceptedParams[$name])) |
| 83 | 82 | { |
| 84 | - call_user_func |
|
| 85 | - ( |
|
| 83 | + call_user_func( |
|
| 86 | 84 | array($this, $acceptedParams[$name]), |
| 87 | 85 | $name, $value |
| 88 | 86 | ); |
@@ -98,7 +96,7 @@ discard block |
||
| 98 | 96 | */ |
| 99 | 97 | protected function setBool($name, $value) |
| 100 | 98 | { |
| 101 | - switch(strtolower($value)) |
|
| 99 | + switch (strtolower($value)) |
|
| 102 | 100 | { |
| 103 | 101 | case '': |
| 104 | 102 | case 'true': |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | $nullable = true; |
| 64 | 64 | break; |
| 65 | 65 | case '<': |
| 66 | - $stack->push($this->resolveGenericName |
|
| 67 | - ( |
|
| 66 | + $stack->push($this->resolveGenericName( |
|
| 68 | 67 | $current, |
| 69 | 68 | $nullable, |
| 70 | 69 | $collection |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | break; |
| 73 | 72 | case ',': |
| 74 | 73 | $stack->top()->generics[] = |
| 75 | - $this->resolveName |
|
| 76 | - ( |
|
| 74 | + $this->resolveName( |
|
| 77 | 75 | $current, |
| 78 | 76 | $nullable, |
| 79 | 77 | $collection |
@@ -89,8 +87,7 @@ discard block |
||
| 89 | 87 | case '>': |
| 90 | 88 | $item = $stack->pop(); |
| 91 | 89 | $item->generics[] = |
| 92 | - $this->resolveName |
|
| 93 | - ( |
|
| 90 | + $this->resolveName( |
|
| 94 | 91 | $current, |
| 95 | 92 | $nullable, |
| 96 | 93 | $collection |
@@ -132,18 +129,17 @@ discard block |
||
| 132 | 129 | } |
| 133 | 130 | elseif ($i + 2 !== strlen($value)) |
| 134 | 131 | { |
| 135 | - if (!in_array($value{$i + 2}, ['>',','])) |
|
| 132 | + if (!in_array($value{$i + 2}, ['>', ','])) |
|
| 136 | 133 | { |
| 137 | 134 | throw new \Exception('Unexpected char after collection'); |
| 138 | 135 | } |
| 139 | 136 | } |
| 140 | 137 | } |
| 141 | 138 | |
| 142 | - protected function resolveGenericName |
|
| 143 | - ( |
|
| 144 | - string &$value, |
|
| 145 | - bool &$nullable, |
|
| 146 | - bool &$collection |
|
| 139 | + protected function resolveGenericName( |
|
| 140 | + string & $value, |
|
| 141 | + bool & $nullable, |
|
| 142 | + bool & $collection |
|
| 147 | 143 | ) |
| 148 | 144 | { |
| 149 | 145 | $type = $this->resolveName($value, $nullable, $collection); |
@@ -156,11 +152,10 @@ discard block |
||
| 156 | 152 | return $type; |
| 157 | 153 | } |
| 158 | 154 | |
| 159 | - protected function resolveName |
|
| 160 | - ( |
|
| 161 | - string &$value, |
|
| 162 | - bool &$nullable, |
|
| 163 | - bool &$collection |
|
| 155 | + protected function resolveName( |
|
| 156 | + string & $value, |
|
| 157 | + bool & $nullable, |
|
| 158 | + bool & $collection |
|
| 164 | 159 | ) |
| 165 | 160 | { |
| 166 | 161 | switch ($value) |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public static function fromName($class, $property) |
| 55 | 55 | { |
| 56 | - return new static(new PHPNativeReflectionProperty |
|
| 57 | - ( |
|
| 56 | + return new static(new PHPNativeReflectionProperty( |
|
| 58 | 57 | $class, $property |
| 59 | 58 | )); |
| 60 | 59 | } |
@@ -72,14 +71,12 @@ discard block |
||
| 72 | 71 | { |
| 73 | 72 | $this->accessor->setRawValue('owner', $parent); |
| 74 | 73 | $this->accessor->setRawValue('defaultValue', $default); |
| 75 | - $this->accessor->setRawValue |
|
| 76 | - ( |
|
| 74 | + $this->accessor->setRawValue( |
|
| 77 | 75 | 'name', |
| 78 | 76 | $this->reflector->getName() |
| 79 | 77 | ); |
| 80 | 78 | |
| 81 | - $this->parseDocComment |
|
| 82 | - ([ |
|
| 79 | + $this->parseDocComment([ |
|
| 83 | 80 | 'readable' => 'setBool', |
| 84 | 81 | 'writable' => 'setBool', |
| 85 | 82 | 'var' => 'setType', |
@@ -97,8 +94,7 @@ discard block |
||
| 97 | 94 | */ |
| 98 | 95 | protected function setType($name, $value) |
| 99 | 96 | { |
| 100 | - $this->accessor->setRawValue |
|
| 101 | - ( |
|
| 97 | + $this->accessor->setRawValue( |
|
| 102 | 98 | 'type', |
| 103 | 99 | (new TypeParser($this->object->owner))->parse($value) |
| 104 | 100 | ); |
@@ -120,50 +116,42 @@ discard block |
||
| 120 | 116 | switch ($value[0]) |
| 121 | 117 | { |
| 122 | 118 | case 'required': |
| 123 | - $this->accessor->setRawValue |
|
| 124 | - ( |
|
| 119 | + $this->accessor->setRawValue( |
|
| 125 | 120 | 'passedToConstructor', |
| 126 | 121 | true |
| 127 | 122 | ); |
| 128 | - $this->accessor->setRawValue |
|
| 129 | - ( |
|
| 123 | + $this->accessor->setRawValue( |
|
| 130 | 124 | 'requiredInConstructor', |
| 131 | 125 | true |
| 132 | 126 | ); |
| 133 | - $compositeAccessor->rawAddToValue |
|
| 134 | - ( |
|
| 127 | + $compositeAccessor->rawAddToValue( |
|
| 135 | 128 | 'requiredProperties', |
| 136 | 129 | $this->object |
| 137 | 130 | ); |
| 138 | 131 | break; |
| 139 | 132 | case 'new': |
| 140 | - $this->accessor->setRawValue |
|
| 141 | - ( |
|
| 133 | + $this->accessor->setRawValue( |
|
| 142 | 134 | 'builtInConstructor', |
| 143 | 135 | true |
| 144 | 136 | ); |
| 145 | - $compositeAccessor->rawAddToValue |
|
| 146 | - ( |
|
| 137 | + $compositeAccessor->rawAddToValue( |
|
| 147 | 138 | 'builtProperties', |
| 148 | 139 | $this->object |
| 149 | 140 | ); |
| 150 | 141 | break; |
| 151 | 142 | case 'optional': |
| 152 | - $this->accessor->setRawValue |
|
| 153 | - ( |
|
| 143 | + $this->accessor->setRawValue( |
|
| 154 | 144 | 'passedToConstructor', |
| 155 | 145 | true |
| 156 | 146 | ); |
| 157 | - $compositeAccessor->rawAddToValue |
|
| 158 | - ( |
|
| 147 | + $compositeAccessor->rawAddToValue( |
|
| 159 | 148 | 'optionalProperties', |
| 160 | 149 | $this->object |
| 161 | 150 | ); |
| 162 | 151 | |
| 163 | 152 | if (isset($value[1]) && $value[1] === 'new') |
| 164 | 153 | { |
| 165 | - $this->accessor->setRawValue |
|
| 166 | - ( |
|
| 154 | + $this->accessor->setRawValue( |
|
| 167 | 155 | 'builtInConstructor', |
| 168 | 156 | true |
| 169 | 157 | ); |