diff --git a/.travis.yml b/.travis.yml index 1e403bf..8d7f0fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 7.0 - 7.1 - 7.2 diff --git a/composer.json b/composer.json index b381106..faa6a62 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,9 @@ } ], "require": { + "php": "~7.1", "laravel/framework": "5.5.* || 5.6.*", - "phpstan/phpstan": "^0.9" + "phpstan/phpstan": "^0.10.1" }, "require-dev": { "phpunit/phpunit": "^6.5.2" @@ -25,10 +26,5 @@ "psr-4": { "Tests\\Weebly\\PHPStan\\Laravel\\": "tests/" } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } } } diff --git a/src/BuilderMethodExtension.php b/src/BuilderMethodExtension.php index 8b137fa..bfef299 100644 --- a/src/BuilderMethodExtension.php +++ b/src/BuilderMethodExtension.php @@ -49,7 +49,7 @@ public function __construct(MethodReflectionFactory $methodReflectionFactory, An /** * @inheritdoc */ - public function setBroker(Broker $broker) + public function setBroker(Broker $broker): void { $this->broker = $broker; } diff --git a/src/FacadeMethodExtension.php b/src/FacadeMethodExtension.php index 5397a9d..0e36d37 100644 --- a/src/FacadeMethodExtension.php +++ b/src/FacadeMethodExtension.php @@ -58,7 +58,7 @@ public function __construct(MethodReflectionFactory $methodReflectionFactory, An /** * @inheritdoc */ - public function setBroker(Broker $broker) + public function setBroker(Broker $broker): void { $this->broker = $broker; } diff --git a/src/MacroMethodExtension.php b/src/MacroMethodExtension.php index 4ec45a6..4e8b007 100644 --- a/src/MacroMethodExtension.php +++ b/src/MacroMethodExtension.php @@ -50,7 +50,7 @@ public function __construct(PhpMethodReflectionFactory $methodReflectionFactory, /** * @inheritdoc */ - public function setBroker(Broker $broker) + public function setBroker(Broker $broker): void { $this->broker = $broker; } diff --git a/src/MethodReflectionFactory.php b/src/MethodReflectionFactory.php index f946b67..6081f46 100644 --- a/src/MethodReflectionFactory.php +++ b/src/MethodReflectionFactory.php @@ -48,6 +48,10 @@ public function create(ClassReflection $classReflection, \ReflectionMethod $meth { $phpDocParameterTypes = []; $phpDocReturnType = null; + $phpDocThrowType = null; + $phpDocIsDeprecated = false; + $phpDocIsInternal = false; + $phpDocIsFinal = false; if ($methodReflection->getDocComment() !== false) { $phpDocBlock = PhpDocBlock::resolvePhpDocBlockForMethod( Broker::getInstance(), @@ -60,12 +64,18 @@ public function create(ClassReflection $classReflection, \ReflectionMethod $meth $resolvedPhpDoc = $this->fileTypeMapper->getResolvedPhpDoc( $phpDocBlock->getFile(), $phpDocBlock->getClass(), + null, $phpDocBlock->getDocComment() ); + $phpDocParameterTypes = array_map(function (ParamTag $tag): Type { return $tag->getType(); }, $resolvedPhpDoc->getParamTags()); $phpDocReturnType = $resolvedPhpDoc->getReturnTag() !== null ? $resolvedPhpDoc->getReturnTag()->getType() : null; + $phpDocThrowType = $resolvedPhpDoc->getThrowsTag() !== null ? $resolvedPhpDoc->getThrowsTag()->getType() : null; + $phpDocIsDeprecated = $resolvedPhpDoc->isDeprecated(); + $phpDocIsInternal = $resolvedPhpDoc->isInternal(); + $phpDocIsFinal = $resolvedPhpDoc->isFinal(); } if ($methodWrapper) { @@ -74,9 +84,14 @@ public function create(ClassReflection $classReflection, \ReflectionMethod $meth return $this->methodReflectionFactory->create( $classReflection, + null, $methodReflection, $phpDocParameterTypes, - $phpDocReturnType + $phpDocReturnType, + $phpDocThrowType, + $phpDocIsDeprecated, + $phpDocIsInternal, + $phpDocIsFinal ); } }