diff --git a/.gitignore b/.gitignore
index 4fbb073..8f4a2b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/vendor/
/composer.lock
+/.idea
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/README.md b/README.md
index f6e7711..69c458b 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,17 @@
-# phpstan-laravel
-Laravel plugins for [PHPStan](https://github.com/phpstan/phpstan)
-
-[](https://travis-ci.org/Weebly/phpstan-laravel)
+# phpstan-lumen
+Lumen plugins for [PHPStan](https://github.com/phpstan/phpstan)
## Usage
To use this extension, require it in [Composer](https://getcomposer.org/):
```
-composer require --dev weebly/phpstan-laravel
+composer require --dev webparking/phpstan-lumen
```
And include extension.neon in your project's PHPStan config:
```
includes:
- - vendor/weebly/phpstan-laravel/extension.neon
+ - vendor/webparking/phpstan-lumen/extension.neon
```
diff --git a/bootstrap.php b/bootstrap.php
index 04d9f90..5131ea2 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -3,5 +3,3 @@
define('LARAVEL_START', microtime(true));
$app = require_once __DIR__ . '/../../../bootstrap/app.php';
-
-$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
diff --git a/composer.json b/composer.json
index b381106..6480eb4 100644
--- a/composer.json
+++ b/composer.json
@@ -1,34 +1,33 @@
{
- "name": "weebly/phpstan-laravel",
+ "name": "webparking2/phpstan-lumen",
"license": "BSD-2-Clause",
- "description": "Laravel plugins for PHPStan",
+ "description": "Lumen plugins for PHPStan",
"type": "library",
"authors": [
{
"name": "Chris Leppanen",
"email": "chris.leppanen@weebly.com"
+ },
+ {
+ "name": "Jeroen van Oort",
+ "email": "jeroen.vanoort@webparking.nl"
}
],
"require": {
- "laravel/framework": "5.5.* || 5.6.*",
- "phpstan/phpstan": "^0.9"
+ "laravel/lumen-framework": "5.5.* || 5.6.* || 5.7.*",
+ "phpstan/phpstan": "0.10.1"
},
"require-dev": {
"phpunit/phpunit": "^6.5.2"
},
"autoload": {
"psr-4": {
- "Weebly\\PHPStan\\Laravel\\": "src/"
+ "Webparking\\PHPStan\\Lumen\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "Tests\\Weebly\\PHPStan\\Laravel\\": "tests/"
- }
- },
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
+ "Tests\\Webparking\\PHPStan\\Lumen\\": "tests/"
}
}
}
diff --git a/extension.neon b/extension.neon
index a8cb534..a269b4b 100644
--- a/extension.neon
+++ b/extension.neon
@@ -1,24 +1,24 @@
services:
-
- class: Weebly\PHPStan\Laravel\MethodReflectionFactory
+ class: Webparking\PHPStan\Lumen\MethodReflectionFactory
-
- class: Weebly\PHPStan\Laravel\BuilderMethodExtension
+ class: Webparking\PHPStan\Lumen\BuilderMethodExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
-
- class: Weebly\PHPStan\Laravel\FacadeMethodExtension
+ class: Webparking\PHPStan\Lumen\FacadeMethodExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
-
- class: Weebly\PHPStan\Laravel\MacroMethodExtension
+ class: Webparking\PHPStan\Lumen\MacroMethodExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
-
- class: Weebly\PHPStan\Laravel\HelpersReturnTypeExtension
+ class: Webparking\PHPStan\Lumen\HelpersReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
- - class: Weebly\PHPStan\Laravel\Utils\AnnotationsHelper
+ - class: Webparking\PHPStan\Lumen\Utils\AnnotationsHelper
parameters:
- bootstrap: %rootDir%/../../weebly/phpstan-laravel/bootstrap.php
+ bootstrap: %rootDir%/../../webparking/phpstan-lumen/bootstrap.php
diff --git a/phpunit.xml b/phpunit.xml
index b983f92..359f953 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -17,7 +17,7 @@
-
+
./tests
diff --git a/src/BuilderMethodExtension.php b/src/BuilderMethodExtension.php
index 8b137fa..1824f84 100644
--- a/src/BuilderMethodExtension.php
+++ b/src/BuilderMethodExtension.php
@@ -1,6 +1,6 @@
broker = $broker;
}
diff --git a/src/FacadeMethodExtension.php b/src/FacadeMethodExtension.php
index 5397a9d..5e76a25 100644
--- a/src/FacadeMethodExtension.php
+++ b/src/FacadeMethodExtension.php
@@ -1,6 +1,6 @@
broker = $broker;
}
diff --git a/src/HelpersReturnTypeExtension.php b/src/HelpersReturnTypeExtension.php
index 81819f9..915c520 100644
--- a/src/HelpersReturnTypeExtension.php
+++ b/src/HelpersReturnTypeExtension.php
@@ -1,6 +1,6 @@
getName()) {
case 'app':
if (empty($functionCall->args) || $scope->getType($functionCall->args[0]->value) instanceof NullType) {
- return new ObjectType(\Illuminate\Foundation\Application::class);
+ return new ObjectType(\Laravel\Lumen\Application::class);
}
$arg1 = $functionCall->args[0];
@@ -58,7 +58,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
return new MixedType();
case 'redirect':
if (empty($functionCall->args)) {
- return new ObjectType(\Illuminate\Routing\Redirector::class);
+ return new ObjectType(\Laravel\Lumen\Http\Redirector::class);
}
return new ObjectType(\Illuminate\Http\RedirectResponse::class);
diff --git a/src/MacroMethodExtension.php b/src/MacroMethodExtension.php
index 4ec45a6..fabe30b 100644
--- a/src/MacroMethodExtension.php
+++ b/src/MacroMethodExtension.php
@@ -1,6 +1,6 @@
broker = $broker;
}
@@ -106,6 +106,7 @@ private function createMethod(ClassReflection $classReflection, \ReflectionFunct
$resolvedPhpDoc = $this->fileTypeMapper->getResolvedPhpDoc(
$functionReflection->getFileName(),
null,
+ null,
$functionReflection->getDocComment()
);
diff --git a/src/MethodReflectionFactory.php b/src/MethodReflectionFactory.php
index f946b67..dbf1435 100644
--- a/src/MethodReflectionFactory.php
+++ b/src/MethodReflectionFactory.php
@@ -1,6 +1,6 @@
getDocComment() !== false) {
$phpDocBlock = PhpDocBlock::resolvePhpDocBlockForMethod(
Broker::getInstance(),
@@ -60,12 +64,17 @@ 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 +83,14 @@ public function create(ClassReflection $classReflection, \ReflectionMethod $meth
return $this->methodReflectionFactory->create(
$classReflection,
+ null,
$methodReflection,
$phpDocParameterTypes,
- $phpDocReturnType
+ $phpDocReturnType,
+ $phpDocThrowType,
+ $phpDocIsDeprecated,
+ $phpDocIsInternal,
+ $phpDocIsFinal
);
}
}
diff --git a/src/ReflectionMethodAlwaysStatic.php b/src/ReflectionMethodAlwaysStatic.php
index ab05f2d..6b06eb8 100644
--- a/src/ReflectionMethodAlwaysStatic.php
+++ b/src/ReflectionMethodAlwaysStatic.php
@@ -1,6 +1,6 @@
makeClassReflectionMock(<<