@@ -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, |
@@ -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); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $i = 0; |
| 83 | 83 | |
| 84 | 84 | $code = |
| 85 | - '<?php namespace ' . $class->namespace . ';' |
|
| 85 | + '<?php namespace ' . $class->namespace . ';' |
|
| 86 | 86 | . 'class ' . $class->classname . ' ' |
| 87 | 87 | . 'extends ' . $originalClass |
| 88 | 88 | . '{'; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return |
| 121 | - ($method->scope === 'static' ? 'static ' : '') |
|
| 121 | + ($method->scope === 'static' ? 'static ' : '') |
|
| 122 | 122 | . 'function ' . $method->name |
| 123 | 123 | . '(' . implode(',', $params) . '){' |
| 124 | 124 | . '__generic_' . $method->name |
@@ -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 | ) |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | public function __toString() |
| 63 | 63 | { |
| 64 | 64 | return |
| 65 | - ($this->namespace ? $this->namespace . '\\' : '') |
|
| 65 | + ($this->namespace ? $this->namespace . '\\' : '') |
|
| 66 | 66 | . $this->classname; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | |
| 118 | 118 | return new ClassName |
| 119 | 119 | ( |
| 120 | - self::BASE . $reflect->classname |
|
| 120 | + self::BASE . $reflect->classname |
|
| 121 | 121 | . '_g' . implode('_c', $items) . '_e' |
| 122 | 122 | ); |
| 123 | 123 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | return $this->inferGenericName($reflect); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - throw new \DomainException |
|
| 73 | - ( |
|
| 72 | + throw new \DomainException( |
|
| 74 | 73 | 'Unknown type: ' . get_class($reflect) |
| 75 | 74 | ); |
| 76 | 75 | } |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | throw new MissingContextException(); |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | - return $this->inferName |
|
| 93 | - ( |
|
| 91 | + return $this->inferName( |
|
| 94 | 92 | $this->context->getGenericType($reflect->name) |
| 95 | 93 | ); |
| 96 | 94 | } |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | $items[] = $this->inferName($generic); |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | - return new ClassName |
|
| 119 | - ( |
|
| 116 | + return new ClassName( |
|
| 120 | 117 | self::BASE . $reflect->classname |
| 121 | 118 | . '_g' . implode('_c', $items) . '_e' |
| 122 | 119 | ); |
@@ -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 | ) |
@@ -50,16 +49,14 @@ discard block |
||
| 50 | 49 | { |
| 51 | 50 | return |
| 52 | 51 | $child instanceof ObjectType && |
| 53 | - is_a |
|
| 54 | - ( |
|
| 52 | + is_a( |
|
| 55 | 53 | $child->classname->__toString(), |
| 56 | 54 | $parent->classname->__toString(), |
| 57 | 55 | true |
| 58 | 56 | ); |
| 59 | 57 | } |
| 60 | 58 | |
| 61 | - throw new \DomainException |
|
| 62 | - ( |
|
| 59 | + throw new \DomainException( |
|
| 63 | 60 | 'Unknown type: ' . get_class($parent) |
| 64 | 61 | ); |
| 65 | 62 | } |