Add support for factory()->create() return types (#758)

* Revert "Forked release"

* Initial factory builder support

* Oops — fixed tabs

* Revert "Forked release"

* Whitespace

* Reverted more code

* Whitespace

* More whitespace

* Fixed PHPCS line
This commit is contained in:
Chris Morrell
2019-10-01 20:18:19 +02:00
committed by Barry vd. Heuvel
parent 25b61c56fe
commit 6c8e847430
8 changed files with 82 additions and 1 deletions
+3 -1
View File
@@ -457,7 +457,9 @@ class ModelsCommand extends Command
$reflection = new \ReflectionMethod($model, $method);
if ($returnType = $reflection->getReturnType()) {
$type = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string)$returnType;
$type = $returnType instanceof \ReflectionNamedType
? $returnType->getName()
: (string)$returnType;
} else {
// php 7.x type or fallback to docblock
$type = (string)$this->getReturnTypeFromDocBlock($reflection);