From b93d4f33cb93874189e82d13039237c3d0218b2e Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 20 Dec 2016 13:53:15 +0100 Subject: [PATCH] Fix stubs location --- src/ComposerScripts.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ComposerScripts.php b/src/ComposerScripts.php index 5aad7ff..d5b06ca 100644 --- a/src/ComposerScripts.php +++ b/src/ComposerScripts.php @@ -32,7 +32,17 @@ class ComposerScripts $parser = new Parser; $definitionResolver = new DefinitionResolver($index); - $stubsLocation = Path::canonicalize(__DIR__ . '/../vendor/JetBrains/phpstorm-stubs'); + $stubsLocation = null; + foreach ([__DIR__ . '/../../../JetBrains/phpstorm-stubs', __DIR__ . '/../vendor/JetBrains/phpstorm-stubs'] as $dir) { + if (file_exists($dir)) { + $stubsLocation = Path::canonicalize($dir); + break; + } + } + if (!$stubsLocation) { + throw new \Exception('JetBrains/phpstorm-stubs package not found'); + } + $uris = yield $finder->find("$stubsLocation/**/*.php"); foreach ($uris as $uri) {