@@ -16,15 +16,8 @@ |
||
| 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 | -use Spaark\CompositeUtils\Service\RawPropertyAccessor; |
|
| 28 | 21 | use Spaark\CompositeUtils\Service\GenericNameProvider; |
| 29 | 22 | use Spaark\CompositeUtils\Traits\AutoConstructTrait; |
| 30 | 23 | |
@@ -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); |
@@ -17,7 +17,6 @@ |
||
| 17 | 17 | use Spaark\CompositeUtils\Model\Reflection\Type\AbstractType; |
| 18 | 18 | use Spaark\CompositeUtils\Model\Reflection\Type\ObjectType; |
| 19 | 19 | use Spaark\CompositeUtils\Model\Reflection\ReflectionComposite; |
| 20 | -use Spaark\CompositeUtils\Traits\AllReadableTrait; |
|
| 21 | 20 | use Spaark\CompositeUtils\Traits\AutoConstructTrait; |
| 22 | 21 | |
| 23 | 22 | /** |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Spaark\CompositeUtils\Model\Reflection\Type\FloatType; |
| 21 | 21 | use Spaark\CompositeUtils\Model\Reflection\Type\MixedType; |
| 22 | 22 | use Spaark\CompositeUtils\Model\Reflection\Type\IntegerType; |
| 23 | -use Spaark\CompositeUtils\Model\Reflection\Type\CollectionType; |
|
| 24 | 23 | use Spaark\CompositeUtils\Model\Reflection\Type\StringType; |
| 25 | 24 | use Spaark\CompositeUtils\Model\Reflection\Type\GenericType; |
| 26 | 25 | use Spaark\CompositeUtils\Model\Generic\GenericContext; |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | return $this->inferGenericName($reflect); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - throw new \DomainException |
|
| 72 | - ( |
|
| 71 | + throw new \DomainException( |
|
| 73 | 72 | 'Unknown type: ' . get_class($reflect) |
| 74 | 73 | ); |
| 75 | 74 | } |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | throw new MissingContextException(); |
| 89 | 88 | } |
| 90 | 89 | |
| 91 | - return $this->inferName |
|
| 92 | - ( |
|
| 90 | + return $this->inferName( |
|
| 93 | 91 | $this->context->getGenericType($reflect->name) |
| 94 | 92 | ); |
| 95 | 93 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | { |
| 36 | 36 | parent::__construct |
| 37 | 37 | ( |
| 38 | - 'Cannot serialize object containing generics without ' |
|
| 38 | + 'Cannot serialize object containing generics without ' |
|
| 39 | 39 | . 'context', |
| 40 | 40 | 0, |
| 41 | 41 | $previous |
@@ -28,13 +28,11 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @param Throwable $previous The exception which caused this |
| 30 | 30 | */ |
| 31 | - public function __construct |
|
| 32 | - ( |
|
| 31 | + public function __construct( |
|
| 33 | 32 | Throwable $previous = null |
| 34 | 33 | ) |
| 35 | 34 | { |
| 36 | - parent::__construct |
|
| 37 | - ( |
|
| 35 | + parent::__construct( |
|
| 38 | 36 | 'Cannot serialize object containing generics without ' |
| 39 | 37 | . 'context', |
| 40 | 38 | 0, |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @param AbstractType $child |
| 32 | 32 | * @return boolean |
| 33 | 33 | */ |
| 34 | - public function compatible |
|
| 35 | - ( |
|
| 34 | + public function compatible( |
|
| 36 | 35 | AbstractType $parent, |
| 37 | 36 | AbstractType $child |
| 38 | 37 | ) |
@@ -53,8 +52,7 @@ discard block |
||
| 53 | 52 | is_a($child->classname, $parent->classname, true); |
| 54 | 53 | } |
| 55 | 54 | |
| 56 | - throw new \DomainException |
|
| 57 | - ( |
|
| 55 | + throw new \DomainException( |
|
| 58 | 56 | 'Unknown type: ' . get_class($parent) |
| 59 | 57 | ); |
| 60 | 58 | } |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param ReflectionCompositeProviderInterface $default |
| 56 | 56 | */ |
| 57 | - public static function setDefault |
|
| 58 | - ( |
|
| 57 | + public static function setDefault( |
|
| 59 | 58 | ReflectionCompositeProviderInterface $default |
| 60 | 59 | ) |
| 61 | 60 | { |
@@ -90,8 +89,7 @@ discard block |
||
| 90 | 89 | { |
| 91 | 90 | $this->cache[$classname] = |
| 92 | 91 | ( |
| 93 | - ReflectionCompositeFactory::fromClassName |
|
| 94 | - ( |
|
| 92 | + ReflectionCompositeFactory::fromClassName( |
|
| 95 | 93 | $classname |
| 96 | 94 | ) |
| 97 | 95 | ) |