Skip to content

Commit

Permalink
Do not run plugin when not installed
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
simPod authored and ondrejmirtes committed May 20, 2019
1 parent 23246cb commit 9dcaf22
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use function file_exists;

final class Plugin implements PluginInterface, EventSubscriberInterface
{
Expand Down Expand Up @@ -53,6 +54,12 @@ public static function getSubscribedEvents(): array
public function process(Event $event): void
{
$io = $event->getIO();

if (!file_exists(__DIR__)) {
$io->write('<info>phpstan/extension-installer:</info> Package not found (probably scheduled for removal); extensions installation skipped.');
return;
}

$composer = $event->getComposer();
$installationManager = $composer->getInstallationManager();

Expand Down

0 comments on commit 9dcaf22

Please sign in to comment.