diff --git a/.gitattributes b/.gitattributes index cc7071b7..b9185ed4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,3 +10,4 @@ /phpcs.xml export-ignore /phpunit.xml.dist export-ignore /test/ export-ignore +/phpstan.neon.dist export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore index 87904ecb..74c0b26b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /laminas-mkdoc-theme/ /phpunit.xml /vendor/ +/phpstan.neon \ No newline at end of file diff --git a/composer.json b/composer.json index 0cf6682c..dfe9f052 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "mikey179/vfsstream": "^1.6.8", "ocramius/proxy-manager": "^2.1.1", "phpbench/phpbench": "^0.13.0", + "phpstan/phpstan": "^0.12.28", "phpunit/phpunit": "^7.5.20" }, "provide": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 00000000..0009f419 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,82 @@ +parameters: + ignoreErrors: + - + message: "#^Return typehint of method Laminas\\\\ServiceManager\\\\AbstractFactory\\\\ReflectionBasedAbstractFactory\\:\\:__invoke\\(\\) has invalid type Laminas\\\\ServiceManager\\\\AbstractFactory\\\\DispatchableInterface\\.$#" + count: 1 + path: src/AbstractFactory/ReflectionBasedAbstractFactory.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$name\\)\\: Unexpected token \"\\$name\", expected type at offset 133$#" + count: 1 + path: src/AbstractFactoryInterface.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$requestedName\\)\\: Unexpected token \"\\$requestedName\", expected type at offset 153$#" + count: 1 + path: src/AbstractFactoryInterface.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$name\\)\\: Unexpected token \"\\$name\", expected type at offset 111$#" + count: 1 + path: src/AbstractFactoryInterface.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$requestedName\\)\\: Unexpected token \"\\$requestedName\", expected type at offset 131$#" + count: 1 + path: src/AbstractFactoryInterface.php + + - + message: "#^PHPDoc tag @throws with type Laminas\\\\ServiceManager\\\\Exception\\\\ServiceNotCreatedException\\|Laminas\\\\ServiceManager\\\\Exception\\\\ServiceNotFoundException\\|Laminas\\\\ServiceManager\\\\Factory\\\\ContainerException is not subtype of Throwable$#" + count: 1 + path: src/Factory/DelegatorFactoryInterface.php + + - + message: "#^PHPDoc tag @throws with type Laminas\\\\ServiceManager\\\\Exception\\\\ServiceNotCreatedException\\|Laminas\\\\ServiceManager\\\\Exception\\\\ServiceNotFoundException\\|Laminas\\\\ServiceManager\\\\Factory\\\\ContainerException is not subtype of Throwable$#" + count: 1 + path: src/Factory/FactoryInterface.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$instance\\)\\: Unexpected token \"\\$instance\", expected type at offset 43$#" + count: 1 + path: src/InitializerInterface.php + + - + message: "#^PHPDoc tag @throws with type Laminas\\\\ServiceManager\\\\ContainerException\\|Laminas\\\\ServiceManager\\\\Exception\\\\InvalidServiceException is not subtype of Throwable$#" + count: 1 + path: src/PluginManagerInterface.php + + - + message: "#^PHPDoc tag @throws with type Psr\\\\Container\\\\ContainerExceptionInterface is not subtype of Throwable$#" + count: 1 + path: src/ServiceLocatorInterface.php + + - + message: "#^PHPDoc tag @param has invalid value \\(bool\\)\\: Unexpected token \"\\\\n \", expected variable at offset 89$#" + count: 1 + path: src/ServiceManager.php + + - + message: "#^Closure invoked with 4 parameters, 0 required\\.$#" + count: 1 + path: src/ServiceManager.php + + - + message: "#^PHPDoc tag @throws with type Laminas\\\\ServiceManager\\\\Exception\\\\ExceptionInterface is not subtype of Throwable$#" + count: 1 + path: src/ServiceManager.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$abstractFactories$#" + count: 1 + path: src/ServiceManager.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$className\\)\\: Unexpected token \"\\$className\", expected type at offset 18$#" + count: 1 + path: src/Tool/ConfigDumper.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$className\\)\\: Unexpected token \"\\$className\", expected type at offset 18$#" + count: 1 + path: src/Tool/FactoryCreator.php + diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..888f3056 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,7 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 3 + paths: + - src