1
0
Fork 0

plugins: mention static analysis support (#10812)

pull/10826/head
Markus Staab 2022-06-06 16:42:24 +02:00 committed by GitHub
parent cb76394800
commit ab9e18027e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -63,6 +63,11 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "2.3-dev" "dev-main": "2.3-dev"
},
"phpstan": {
"includes": [
"phpstan/rules.neon"
]
} }
}, },
"autoload": { "autoload": {

View File

@ -339,6 +339,25 @@ depend on other packages can function correctly, a runtime autoloader is created
a plugin is loaded. That autoloader is only configured to load with the plugin dependencies, a plugin is loaded. That autoloader is only configured to load with the plugin dependencies,
so you may not have access to all the packages which are installed. so you may not have access to all the packages which are installed.
## Static Analysis support
As of Composer 2.3.7 we ship a `phpstan/rules.neon` PHPStan config file, which provides additional error checking when working on Composer plugins.
### Usage with [PHPStan Extension Installer][13]
The necessary configuration files are automatically loaded, in case your plugin projects declares a dependency to `phpstan/extension-installer`.
### Alternative manual installation
To make use of it, your Composer plugin project needs a [PHPStan config file][12], which includes the `phpstan/rules.neon` file:
```
includes:
- vendor/composer/composer/phpstan/rules.neon
// your remaining config..
```
[1]: ../04-schema.md#type [1]: ../04-schema.md#type
[2]: ../04-schema.md#extra [2]: ../04-schema.md#extra
[3]: https://github.com/composer/composer/blob/main/src/Composer/Plugin/PluginInterface.php [3]: https://github.com/composer/composer/blob/main/src/Composer/Plugin/PluginInterface.php
@ -350,3 +369,5 @@ so you may not have access to all the packages which are installed.
[9]: https://github.com/composer/composer/blob/main/src/Composer/Plugin/Capability/CommandProvider.php [9]: https://github.com/composer/composer/blob/main/src/Composer/Plugin/Capability/CommandProvider.php
[10]: https://symfony.com/doc/current/components/console.html [10]: https://symfony.com/doc/current/components/console.html
[11]: https://github.com/composer/composer/blob/main/src/Composer/Util/SyncHelper.php [11]: https://github.com/composer/composer/blob/main/src/Composer/Util/SyncHelper.php
[12]: https://phpstan.org/config-reference#multiple-files
[13]: https://github.com/phpstan/extension-installer#usage