diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 76ab07e..1535374 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -32,5 +32,5 @@ jobs: - name: Check CS-Fixer run: composer cs:check -# - name: Check PHPStan -# run: composer phpstan + - name: Check PHPStan + run: composer phpstan diff --git a/composer.json b/composer.json index ea7024c..c71e7fb 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,11 @@ "doctrine/orm": "^2.7", "ergebnis/composer-normalize": "^2.6.1", "friendsofphp/php-cs-fixer": "^3.0", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-symfony": "^1.2", "phpunit/phpunit": "^9.3", "vimeo/psalm": "^4.3" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..53a1f75 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,56 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#2 \\$registry of class Neusta\\\\Pimcore\\\\TestingFramework\\\\Database\\\\PimcoreDatabaseResetter constructor expects Doctrine\\\\Persistence\\\\ManagerRegistry, object given\\.$#" + count: 1 + path: src/Database/DatabaseResetter.php + + - + message: "#^Method Neusta\\\\Pimcore\\\\TestingFramework\\\\Database\\\\PimcoreInstaller\\:\\:getDataFiles\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^Method Neusta\\\\Pimcore\\\\TestingFramework\\\\Database\\\\PimcoreInstaller\\:\\:getDataFiles\\(\\) should return array but returns array\\\\|false\\.$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^PHPDoc tag @throws with type Doctrine\\\\DBAL\\\\DBALException is not subtype of Throwable$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^Parameter \\#1 \\$sql of method Doctrine\\\\DBAL\\\\Connection\\:\\:exec\\(\\) expects string, string\\|false given\\.$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|false given\\.$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^Property Neusta\\\\Pimcore\\\\TestingFramework\\\\Database\\\\PimcoreInstaller\\:\\:\\$dumpLocation \\(string\\|null\\) does not accept string\\|false\\.$#" + count: 1 + path: src/Database/PimcoreInstaller.php + + - + message: "#^Method Neusta\\\\Pimcore\\\\TestingFramework\\\\Database\\\\RunCommand\\:\\:__invoke\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Database/RunCommand.php + + - + message: "#^Method Pimcore\\\\Kernel\\:\\:configureContainer\\(\\) invoked with 1 parameter, 3 required\\.$#" + count: 1 + path: src/Kernel/TestKernel.php + + - + message: "#^Parameter \\#1 \\$bundle of method Pimcore\\\\HttpKernel\\\\BundleCollection\\\\BundleCollection\\:\\:addBundle\\(\\) expects string\\|Symfony\\\\Component\\\\HttpKernel\\\\Bundle\\\\BundleInterface, Pimcore\\\\Bundle\\\\AdminBundle\\\\PimcoreAdminBundle given\\.$#" + count: 1 + path: src/Kernel/TestKernel.php + + - + message: "#^Parameter \\#1 \\$name of static method Neusta\\\\Pimcore\\\\TestingFramework\\\\Pimcore\\\\BootstrapPimcore\\:\\:setEnv\\(\\) expects string, int\\|string given\\.$#" + count: 1 + path: src/Pimcore/BootstrapPimcore.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..27621dc --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,14 @@ +includes: + - phpstan-baseline.neon + +parameters: + + level: 8 + + paths: + - src + + bootstrapFiles: + - vendor/pimcore/pimcore/stubs/dynamic-constants.php + + checkGenericClassInNonGenericObjectType: false