@@ -14,8 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace Spaark\CompositeUtils\Model\Collection\Map; |
| 16 | 16 | |
| 17 | -use Spaark\CompositeUtils\Traits\AutoConstructTrait; |
|
| 18 | - |
|
| 19 | 17 | /** |
| 20 | 18 | * Abstract Iterator for Map datatypes |
| 21 | 19 | * |
@@ -37,8 +37,6 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Adds an element to the Map |
| 39 | 39 | * |
| 40 | - * @param KeyType $key The key to add |
|
| 41 | - * @param ValueType $value The value to add |
|
| 42 | 40 | */ |
| 43 | 41 | public function insert(Pair $pair) |
| 44 | 42 | { |
@@ -59,7 +57,7 @@ discard block |
||
| 59 | 57 | /** |
| 60 | 58 | * Checks if a key exists |
| 61 | 59 | * |
| 62 | - * @param KeyType $key The key to search for |
|
| 60 | + * @param string $key The key to search for |
|
| 63 | 61 | * @return boolean |
| 64 | 62 | */ |
| 65 | 63 | public function containsKey($key) : bool |
@@ -103,6 +101,9 @@ discard block |
||
| 103 | 101 | return $this->list->size(); |
| 104 | 102 | } |
| 105 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $key |
|
| 106 | + */ |
|
| 106 | 107 | public function indexOfKey($key) |
| 107 | 108 | { |
| 108 | 109 | return $this->getPair($key)->index; |
@@ -44,8 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | if (!$pair instanceof OrderedPair) |
| 46 | 46 | { |
| 47 | - $pair = new OrderedPair |
|
| 48 | - ( |
|
| 47 | + $pair = new OrderedPair( |
|
| 49 | 48 | $this->size(), |
| 50 | 49 | $pair->key, |
| 51 | 50 | $pair->value |
@@ -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 | } |
@@ -73,8 +73,7 @@ |
||
| 73 | 73 | public function generateClassCode(...$generics) : string |
| 74 | 74 | { |
| 75 | 75 | $object = $this->createObject(...$generics); |
| 76 | - $this->nameProvider = new GenericNameProvider |
|
| 77 | - ( |
|
| 76 | + $this->nameProvider = new GenericNameProvider( |
|
| 78 | 77 | new GenericContext($object, $this->reflect) |
| 79 | 78 | ); |
| 80 | 79 | $class = $this->nameProvider->inferName($object); |
@@ -16,16 +16,9 @@ |
||
| 16 | 16 | |
| 17 | 17 | use Spaark\CompositeUtils\Model\Reflection\ReflectionComposite; |
| 18 | 18 | use Spaark\CompositeUtils\Model\Reflection\ReflectionMethod; |
| 19 | -use Spaark\CompositeUtils\Model\Reflection\Type\BooleanType; |
|
| 20 | -use Spaark\CompositeUtils\Model\Reflection\Type\CollectionType; |
|
| 21 | -use Spaark\CompositeUtils\Model\Reflection\Type\IntegerType; |
|
| 22 | -use Spaark\CompositeUtils\Model\Reflection\Type\MixedType; |
|
| 23 | 19 | use Spaark\CompositeUtils\Model\Reflection\Type\ObjectType; |
| 24 | -use Spaark\CompositeUtils\Model\Reflection\Type\StringType; |
|
| 25 | -use Spaark\CompositeUtils\Model\Reflection\Type\GenericType; |
|
| 26 | 20 | use Spaark\CompositeUtils\Model\Generic\GenericContext; |
| 27 | 21 | use Spaark\CompositeUtils\Model\ClassName; |
| 28 | -use Spaark\CompositeUtils\Service\RawPropertyAccessor; |
|
| 29 | 22 | use Spaark\CompositeUtils\Service\GenericNameProvider; |
| 30 | 23 | use Spaark\CompositeUtils\Traits\AutoConstructPropertyAccessTrait; |
| 31 | 24 | use Spaark\CompositeUtils\Traits\GenericTrait; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $i = 0; |
| 93 | 93 | |
| 94 | 94 | $code = |
| 95 | - 'namespace ' . $class->namespace . ';' |
|
| 95 | + 'namespace ' . $class->namespace . ';' |
|
| 96 | 96 | . 'class ' . $class->classname . ' ' |
| 97 | 97 | . 'extends \\' . $originalClass . ' ' |
| 98 | 98 | . 'implements \\' . Generic::class |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | return |
| 133 | - ($method->scope === 'static' ? 'static ' : '') |
|
| 133 | + ($method->scope === 'static' ? 'static ' : '') |
|
| 134 | 134 | . 'function ' . $method->name |
| 135 | 135 | . '(' . implode(',', $params) . '){' |
| 136 | 136 | . '__generic_' . $method->name |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->initParams(); |
| 98 | 98 | |
| 99 | 99 | $this->accessor->setRawValue('visibility', |
| 100 | - ($this->reflector->isPublic() ? 'public' |
|
| 100 | + ($this->reflector->isPublic() ? 'public' |
|
| 101 | 101 | : ($this->reflector->isProtected() ? 'protected' |
| 102 | 102 | : ($this->reflector->isPrivate() ? 'private' |
| 103 | 103 | : ('')))) |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | throw new \Exception |
| 156 | 156 | ( |
| 157 | - 'Tried to set param annotation for non existant ' |
|
| 157 | + 'Tried to set param annotation for non existant ' |
|
| 158 | 158 | . 'parameter: ' . $param |
| 159 | 159 | ); |
| 160 | 160 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | throw new \Exception |
| 170 | 170 | ( |
| 171 | - 'Types are incompatible for: ' |
|
| 171 | + 'Types are incompatible for: ' |
|
| 172 | 172 | . $this->reflector->getName() . '::' . $items[1] |
| 173 | 173 | ); |
| 174 | 174 | } |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function fromName(string $class, string $method) |
| 66 | 66 | { |
| 67 | - return new static(new PHPNativeReflectionMethod |
|
| 68 | - ( |
|
| 67 | + return new static(new PHPNativeReflectionMethod( |
|
| 69 | 68 | $class, $method |
| 70 | 69 | )); |
| 71 | 70 | } |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | { |
| 90 | 89 | $this->typeParser = new TypeParser($parent); |
| 91 | 90 | $this->accessor->setRawValue('owner', $parent); |
| 92 | - $this->accessor->setRawValue |
|
| 93 | - ( |
|
| 91 | + $this->accessor->setRawValue( |
|
| 94 | 92 | 'name', |
| 95 | 93 | $this->reflector->getName() |
| 96 | 94 | ); |
@@ -118,8 +116,7 @@ discard block |
||
| 118 | 116 | $type = $this->reflector->getReturnType(); |
| 119 | 117 | if ($type) |
| 120 | 118 | { |
| 121 | - $this->accessor->setRawValue |
|
| 122 | - ( |
|
| 119 | + $this->accessor->setRawValue( |
|
| 123 | 120 | 'nativeReturnType', |
| 124 | 121 | !$type->isBuiltin() ? '\\' . $type : (string)$type |
| 125 | 122 | ); |
@@ -136,13 +133,11 @@ discard block |
||
| 136 | 133 | */ |
| 137 | 134 | protected function initParams() |
| 138 | 135 | { |
| 139 | - $this->accessor->setRawValue |
|
| 140 | - ( |
|
| 136 | + $this->accessor->setRawValue( |
|
| 141 | 137 | 'parameters', |
| 142 | 138 | new FixedList(count($this->reflector->getParameters())) |
| 143 | 139 | ); |
| 144 | - $this->accessor->setRawValue |
|
| 145 | - ( |
|
| 140 | + $this->accessor->setRawValue( |
|
| 146 | 141 | 'nativeParameters', |
| 147 | 142 | new FixedList(count($this->reflector->getParameters())) |
| 148 | 143 | ); |
@@ -163,8 +158,7 @@ discard block |
||
| 163 | 158 | |
| 164 | 159 | if (!$this->parameters->containsKey($param)) |
| 165 | 160 | { |
| 166 | - throw new \Exception |
|
| 167 | - ( |
|
| 161 | + throw new \Exception( |
|
| 168 | 162 | 'Tried to set param annotation for non existant ' |
| 169 | 163 | . 'parameter: ' . $param |
| 170 | 164 | ); |
@@ -177,8 +171,7 @@ discard block |
||
| 177 | 171 | |
| 178 | 172 | if (!$comparator->compatible($nativeType, $type)) |
| 179 | 173 | { |
| 180 | - throw new \Exception |
|
| 181 | - ( |
|
| 174 | + throw new \Exception( |
|
| 182 | 175 | 'Types are incompatible for: ' |
| 183 | 176 | . $this->reflector->getName() . '::' . $items[1] |
| 184 | 177 | ); |
@@ -193,8 +186,7 @@ discard block |
||
| 193 | 186 | * |
| 194 | 187 | * @param PHPNativeReflectionParameter $reflect |
| 195 | 188 | */ |
| 196 | - protected function addParameter |
|
| 197 | - ( |
|
| 189 | + protected function addParameter( |
|
| 198 | 190 | PHPNativeReflectionParameter $reflect |
| 199 | 191 | ) |
| 200 | 192 | : void |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | if (!$this->genericContext) |
| 67 | 67 | { |
| 68 | - $this->genericContext = new GenericContext |
|
| 69 | - ( |
|
| 68 | + $this->genericContext = new GenericContext( |
|
| 70 | 69 | $this->getObjectType(), |
| 71 | 70 | static::getReflectionComposite() |
| 72 | 71 | ); |
@@ -86,8 +85,7 @@ discard block |
||
| 86 | 85 | { |
| 87 | 86 | if ($this->genericContext) |
| 88 | 87 | { |
| 89 | - throw new ImmutablePropertyException |
|
| 90 | - ( |
|
| 88 | + throw new ImmutablePropertyException( |
|
| 91 | 89 | (string)$this->getObjectType(), |
| 92 | 90 | 'genericContext' |
| 93 | 91 | ); |
@@ -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,8 +59,7 @@ discard block |
||
| 60 | 59 | */ |
| 61 | 60 | protected $hashProducer; |
| 62 | 61 | |
| 63 | - public function __construct |
|
| 64 | - ( |
|
| 62 | + public function __construct( |
|
| 65 | 63 | ?HashProducerInterface $hashProducer = null |
| 66 | 64 | ) |
| 67 | 65 | { |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * {@inheritDoc} |
| 47 | 47 | */ |
| 48 | - public function splice |
|
| 49 | - ( |
|
| 48 | + public function splice( |
|
| 50 | 49 | int $offset, |
| 51 | 50 | ?int $length = null, |
| 52 | 51 | array $replacement = [] |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | /** |
| 57 | 57 | * {@inheritDoc} |
| 58 | 58 | */ |
| 59 | - public function splice |
|
| 60 | - ( |
|
| 59 | + public function splice( |
|
| 61 | 60 | int $offset, |
| 62 | 61 | ?int $length = null, |
| 63 | 62 | array $replacement = [] |