Commit 1385f81d authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Découpage de la configuration en plusieurs variantes.

No related merge requests found
Pipeline #5541 passed with stages
in 1 minute
Showing with 51 additions and 24 deletions
+51 -24
......@@ -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
......@@ -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
},
......
loose.neon 0 → 100644
includes:
- ../../phpstan/phpstan-beberlei-assert/extension.neon
parameters:
level: 1
memory-limit: 500M
excludes_analyse:
- %rootDir%/../../vendor
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
includes:
- ../../phpstan/phpstan-phpunit/extension.neon
- ../../phpstan/phpstan-phpunit/rules.neon
- ../../jangregor/phpstan-prophecy/src/extension.neon
strict.neon 0 → 100644
includes:
- ./loose.neon
parameters:
level: 7
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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment