@@ -78,8 +78,8 @@ |
||
78 | 78 | return $this->name; |
79 | 79 | } |
80 | 80 | |
81 | - public function __toString(): string |
|
82 | - { |
|
83 | - return (string) $this->getName(); |
|
84 | - } |
|
81 | + public function __toString(): string |
|
82 | + { |
|
83 | + return (string) $this->getName(); |
|
84 | + } |
|
85 | 85 | } |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | return new static($name); |
58 | 58 | } |
59 | 59 | |
60 | - public static function fromName(string $name): self |
|
61 | - { |
|
62 | - $ref = new \ReflectionClass($name); |
|
60 | + public static function fromName(string $name): self |
|
61 | + { |
|
62 | + $ref = new \ReflectionClass($name); |
|
63 | 63 | |
64 | - return static::fromFile($ref->getFileName()); |
|
65 | - } |
|
64 | + return static::fromFile($ref->getFileName()); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Creates a new struct |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @return $this |
136 | 136 | */ |
137 | 137 | public function addUseStatement($qualifiedName, string $alias = null) { |
138 | - if ($qualifiedName instanceof PhpTypeInterface) { |
|
139 | - $qualifiedName = $qualifiedName->getQualifiedName(); |
|
140 | - } |
|
138 | + if ($qualifiedName instanceof PhpTypeInterface) { |
|
139 | + $qualifiedName = $qualifiedName->getQualifiedName(); |
|
140 | + } |
|
141 | 141 | |
142 | - if (TypeUtils::isGlobalQualifiedName($qualifiedName) || TypeUtils::isNativeType($qualifiedName)) { |
|
143 | - return $this; |
|
144 | - } |
|
142 | + if (TypeUtils::isGlobalQualifiedName($qualifiedName) || TypeUtils::isNativeType($qualifiedName)) { |
|
143 | + return $this; |
|
144 | + } |
|
145 | 145 | |
146 | - if (preg_replace('#\\\\[^\\\\]+$#', '', $qualifiedName) === $this->getNamespace()) { |
|
147 | - return $this; |
|
148 | - } |
|
146 | + if (preg_replace('#\\\\[^\\\\]+$#', '', $qualifiedName) === $this->getNamespace()) { |
|
147 | + return $this; |
|
148 | + } |
|
149 | 149 | |
150 | 150 | if (!is_string($alias)) { |
151 | 151 | if (false === strpos($qualifiedName, '\\')) { |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | $method->setParent($this); |
274 | 274 | $this->methods->set($method->getName(), $method); |
275 | 275 | $types = $method->getTypes(); |
276 | - if ($types) { |
|
277 | - foreach ($types as $type) { |
|
278 | - $this->addUseStatement($type); |
|
279 | - $method->addType($type); |
|
280 | - } |
|
281 | - } |
|
282 | - |
|
283 | - foreach ($method->getParameters() as $parameter) { |
|
284 | - $types = $parameter->getTypes(); |
|
285 | - if ($types) { |
|
286 | - foreach ($types as $type) { |
|
287 | - $this->addUseStatement($type); |
|
288 | - $parameter->addType($type); |
|
289 | - } |
|
290 | - } |
|
291 | - } |
|
292 | - |
|
293 | - return $this; |
|
276 | + if ($types) { |
|
277 | + foreach ($types as $type) { |
|
278 | + $this->addUseStatement($type); |
|
279 | + $method->addType($type); |
|
280 | + } |
|
281 | + } |
|
282 | + |
|
283 | + foreach ($method->getParameters() as $parameter) { |
|
284 | + $types = $parameter->getTypes(); |
|
285 | + if ($types) { |
|
286 | + foreach ($types as $type) { |
|
287 | + $this->addUseStatement($type); |
|
288 | + $parameter->addType($type); |
|
289 | + } |
|
290 | + } |
|
291 | + } |
|
292 | + |
|
293 | + return $this; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |