-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa7e03b
commit ebed6ef
Showing
1 changed file
with
65 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,65 @@ | ||
# PHPStan Extension Installer | ||
|
||
Composer plugin for automatic installation of [PHPStan](https://github.com/phpstan/phpstan) extensions. | ||
|
||
## Usage | ||
|
||
```bash | ||
composer require --dev phpstan/extension-installer | ||
``` | ||
|
||
And that's it. | ||
|
||
## Extension usage & features | ||
|
||
Extension's composer package [type](https://getcomposer.org/doc/04-schema.md#type) has to be set to `phpstan-extension` for this plugin to be able to recognize it. | ||
|
||
Only one feature is supported right now: PHPStan is able to automatically include the extension's config files, without you having to mention them in your `phpstan.neon`'s `includes` section. | ||
|
||
For this, you have to add a `phpstan` key in the extension `composer.json`'s `extra` section like so: | ||
|
||
```json | ||
{ | ||
"extra": { | ||
"phpstan": { | ||
"includes": [ | ||
"extension.neon" | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
# PHPStan Extension Installer | ||
|
||
Composer plugin for automatic installation of [PHPStan](https://github.com/phpstan/phpstan) extensions. | ||
|
||
# Motivation | ||
|
||
```diff | ||
diff --git a/phpstan.neon b/phpstan.neon | ||
index db4e3df32e..2ca30fa20a 100644 | ||
--- a/phpstan.neon | ||
+++ b/phpstan.neon | ||
@@ -1,12 +1,3 @@ | ||
-includes: | ||
- - vendor/phpstan/phpstan-doctrine/extension.neon | ||
- - vendor/phpstan/phpstan-doctrine/rules.neon | ||
- - vendor/phpstan/phpstan-nette/extension.neon | ||
- - vendor/phpstan/phpstan-nette/rules.neon | ||
- - vendor/phpstan/phpstan-phpunit/extension.neon | ||
- - vendor/phpstan/phpstan-phpunit/rules.neon | ||
- - vendor/phpstan/phpstan-strict-rules/rules.neon | ||
- | ||
parameters: | ||
autoload_directories: | ||
- %rootDir%/../../../build/SlevomatSniffs | ||
diff --git a/composer.json b/composer.json | ||
index 1b578dd624..f6ebf6e477 100644 | ||
--- a/composer.json | ||
+++ b/composer.json | ||
@@ -142,6 +142,7 @@ | ||
"jakub-onderka/php-parallel-lint": "1.0.0", | ||
"justinrainbow/json-schema": "5.2.8", | ||
"ondrejmirtes/mocktainer": "0.8", | ||
+ "phpstan/extension-installer": "1.0", | ||
"phpstan/phpstan": "^0.11.7", | ||
"phpstan/phpstan-doctrine": "^0.11.3", | ||
"phpstan/phpstan-nette": "^0.11.1", | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
composer require --dev phpstan/extension-installer | ||
``` | ||
|
||
And that's it. | ||
|
||
## Instructions for extension developers | ||
|
||
Extension's composer package [type](https://getcomposer.org/doc/04-schema.md#type) has to be set to `phpstan-extension` for this plugin to be able to recognize it. | ||
|
||
Only one feature is supported right now: PHPStan is able to automatically include the extension's config files, without you having to mention them in your `phpstan.neon`'s `includes` section. | ||
|
||
For this, you have to add a `phpstan` key in the extension `composer.json`'s `extra` section like so: | ||
|
||
```json | ||
{ | ||
"extra": { | ||
"phpstan": { | ||
"includes": [ | ||
"extension.neon" | ||
] | ||
} | ||
} | ||
} | ||
``` |