Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 7.0
- 7.1
- 7.2

Expand Down
8 changes: 2 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -25,10 +26,5 @@
"psr-4": {
"Tests\\Weebly\\PHPStan\\Laravel\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion src/BuilderMethodExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FacadeMethodExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MacroMethodExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(PhpMethodReflectionFactory $methodReflectionFactory,
/**
* @inheritdoc
*/
public function setBroker(Broker $broker)
public function setBroker(Broker $broker): void
{
$this->broker = $broker;
}
Expand Down
17 changes: 16 additions & 1 deletion src/MethodReflectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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) {
Expand All @@ -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
);
}
}