Skip to content

Commit

Permalink
Don't force the package type
Browse files Browse the repository at this point in the history
phpstan/extension-installer will work if the package type is
`phpstan-extension` or if the `extra.phpstan.includes` key is
configured.
  • Loading branch information
jdeniau authored and ondrejmirtes committed Oct 18, 2019
1 parent 91d49ed commit 2956567
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ 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.
It's best (but optional) to set the extension's composer package [type](https://getcomposer.org/doc/04-schema.md#type) to `phpstan-extension` for this plugin to be able to recognize it and to be [discoverable on Packagist](https://packagist.org/explore/?type=phpstan-extension).

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.

Expand Down
5 changes: 4 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public function process(Event $event): void

$data = [];
foreach ($composer->getRepositoryManager()->getLocalRepository()->getPackages() as $package) {
if ($package->getType() !== 'phpstan-extension') {
if (
$package->getType() !== 'phpstan-extension'
&& !isset($package->getExtra()['phpstan'])
) {
if (
strpos($package->getName(), 'phpstan') !== false
&& !in_array($package->getName(), [
Expand Down

0 comments on commit 2956567

Please sign in to comment.