diff --git a/README.md b/README.md index ba5446d73685c53ea81b6609ca8bb2a078e9f436..42420b764eedbdbecc7ecb4b3da52053d3bc5efb 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Configuration pour phpstan/phpstan. Inclut les extensions PHPStan pour les outils suivant : -- Doctrine -- Symfony -- PHPUnit -- [beberlei/assert](https://github.com/beberlei/assert) -- [phpspec/prophecy](https://github.com/phpspec/prophecy) +- Doctrine => [phpstan/phpstan-doctrine](https://github.com/phpstan/phpstan-doctrine) +- Symfony => [phpstan/phpstan-symfony](https://github.com/phpstan/phpstan-symfony) +- PHPUnit => [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) +- [beberlei/assert](https://github.com/beberlei/assert) => [phpstan/phpstan-beberlei-assert](https://github.com/phpstan/phpstan-beberlei-assert) +- [phpspec/prophecy](https://github.com/phpspec/prophecy) => [jangregor/phpstan-prophecy](https://github.com/Jan0707/phpstan-prophecy) ### Installation @@ -16,7 +16,15 @@ Inclut les extensions PHPStan pour les outils suivant : composer require --dev irstea/phpstan-config ``` -### Configuration +### Utilisation + +Le paquet fournit plusieurs fichiers de configuration à inclure selon les besoins: + +- [`loose.neon`](loose.neon): vérifications _souples_, +- [`strict.neon`](strict.neon): vérifications _strictes_ (inclut `loose.neon`), +- [`phpunit.neon`](phpunit.neon): à inclure dans les projets utilisant PHPUnit, +- [`symfony.neon`](symfony.neon): à inclure dans les projets utilisant Symfony et Doctrine. +- [`phpstan.neon`](phpstan.neon): `strict.neon` + `phpunit.neon` + `symfony.neon`. Exemple : @@ -30,14 +38,8 @@ parameters: - tests symfony: - container_xml_path: %currentWorkingDirectory%/var/cache/test/srcApp_KernelTestDebugContainer.xml + container_xml_path: %currentWorkingDirectory%/var/cache/test/srcApp_KernelTestDebugContainer.xml ``` -cf. https://github.com/phpstan/phpstan#configuration pour plus de détails. - -### Usage - -```shell -vendor/bin/phpstan analyse -``` +**Note :** `container_xml_path` change selon la version de Symfony, cf. https://github.com/phpstan/phpstan-symfony#usage diff --git a/composer.json b/composer.json index e51127268f7928eb8d58f3446bffb08786eb74ae..31a4bd598631b38c9b134068322d89ff393a60fb 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,11 @@ "phpstan/phpstan-phpunit": "^0.11", "phpstan/phpstan-symfony": "^0.11" }, + "suggest": { + "beberlei/assert": "Framework léger d'assertion de type.", + "phpunit/phpunit": "Framework de tests unitaires.", + "phpspec/prophecy": "Framework de mocking pour les tests unitaires." + }, "config": { "sort-packages": true }, diff --git a/loose.neon b/loose.neon new file mode 100644 index 0000000000000000000000000000000000000000..d5b4a0ae91a3d860318a4217a5b0cfd871611724 --- /dev/null +++ b/loose.neon @@ -0,0 +1,9 @@ +includes: + - ../../phpstan/phpstan-beberlei-assert/extension.neon + +parameters: + level: 1 + memory-limit: 500M + + excludes_analyse: + - %rootDir%/../../vendor diff --git a/phpstan.neon b/phpstan.neon index 584febc4481a9a1795b63405a02a5c4395f44269..afb02ddf25b0dcdfbaae502c6da53e1c2a657c6a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,11 +1,4 @@ includes: - - ../../phpstan/phpstan-doctrine/extension.neon - - ../../phpstan/phpstan-symfony/extension.neon - - ../../phpstan/phpstan-phpunit/extension.neon - - ../../phpstan/phpstan-phpunit/rules.neon - - ../../jangregor/phpstan-prophecy/src/extension.neon - - ../../phpstan/phpstan-beberlei-assert/extension.neon - -parameters: - level: 7 - memory-limit: 500M + - ./strict.neon + - ./symfony.neon + - ./phpunit.neon diff --git a/phpunit.neon b/phpunit.neon new file mode 100644 index 0000000000000000000000000000000000000000..ddde8bc0c7238a639f077611364e02a4af2233a3 --- /dev/null +++ b/phpunit.neon @@ -0,0 +1,4 @@ +includes: + - ../../phpstan/phpstan-phpunit/extension.neon + - ../../phpstan/phpstan-phpunit/rules.neon + - ../../jangregor/phpstan-prophecy/src/extension.neon diff --git a/strict.neon b/strict.neon new file mode 100644 index 0000000000000000000000000000000000000000..4226301c4da6a8bab0afdbb91c74388ad077098b --- /dev/null +++ b/strict.neon @@ -0,0 +1,5 @@ +includes: + - ./loose.neon + +parameters: + level: 7 diff --git a/symfony.neon b/symfony.neon new file mode 100644 index 0000000000000000000000000000000000000000..18b95ad7d801d9e83d900c56cd62c291f67c5513 --- /dev/null +++ b/symfony.neon @@ -0,0 +1,9 @@ +includes: + - ../../phpstan/phpstan-doctrine/extension.neon + - ../../phpstan/phpstan-doctrine/rules.neon + - ../../phpstan/phpstan-symfony/extension.neon + + excludes_analyse: + - %rootDir%/../../../var + - %rootDir%/../../../app/cache + - %rootDir%/../../../app/logs