@@ -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 | ( |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace Spaark\CompositeUtils\Factory\Reflection; |
| 16 | 16 | |
| 17 | -use Spaark\CompositeUtils\Factory\BaseFactory; |
|
| 18 | 17 | use Spaark\CompositeUtils\Model\Reflection\ReflectionComposite; |
| 19 | 18 | use Spaark\CompositeUtils\Model\Reflection\ReflectionProperty; |
| 20 | 19 | use Spaark\CompositeUtils\Model\Reflection\ReflectionMethod; |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | 159 | $factory = |
| 160 | - '\Spaark\CompositeUtils\Factory\Reflection' |
|
| 160 | + '\Spaark\CompositeUtils\Factory\Reflection' |
|
| 161 | 161 | . '\Reflection' . $signular . 'Factory'; |
| 162 | 162 | $item = $this->{'build' . $signular} |
| 163 | 163 | ( |
@@ -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()] |
@@ -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)) |
@@ -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) |
@@ -106,8 +106,7 @@ discard block |
||
| 106 | 106 | if ($stack->isEmpty()) |
| 107 | 107 | { |
| 108 | 108 | return $item; |
| 109 | - } |
|
| 110 | - else |
|
| 109 | + } else |
|
| 111 | 110 | { |
| 112 | 111 | $stack->top()->types[] = $item; |
| 113 | 112 | } |
@@ -125,12 +124,10 @@ discard block |
||
| 125 | 124 | if ($i + 1 === strlen($value)) |
| 126 | 125 | { |
| 127 | 126 | throw new \Exception('Unexpected EOF'); |
| 128 | - } |
|
| 129 | - elseif ($value{$i + 1} !== ']') |
|
| 127 | + } elseif ($value{$i + 1} !== ']') |
|
| 130 | 128 | { |
| 131 | 129 | throw new \Exception('[ must be followed by ]'); |
| 132 | - } |
|
| 133 | - elseif ($i + 2 !== strlen($value)) |
|
| 130 | + } elseif ($i + 2 !== strlen($value)) |
|
| 134 | 131 | { |
| 135 | 132 | if (!in_array($value{$i + 2}, ['>',','])) |
| 136 | 133 | { |
@@ -189,8 +186,7 @@ discard block |
||
| 189 | 186 | if ($useStatements->containsKey($value)) |
| 190 | 187 | { |
| 191 | 188 | $value = $useStatements[$value]->classname; |
| 192 | - } |
|
| 193 | - else |
|
| 189 | + } else |
|
| 194 | 190 | { |
| 195 | 191 | $value = $this->context->namespace->namespace |
| 196 | 192 | . '\\' . $value; |