diff --git a/.gitattributes b/.gitattributes index 3b537a3bf05..3a0f294ec18 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,3 +29,4 @@ phpstan.neon export-ignore phpunit.xml export-ignore rector.yaml export-ignore utils export-ignore +stubs export-ignore diff --git a/src/Stubs/StubLoader.php b/src/Stubs/StubLoader.php index cc1786700d6..36dfbb407e9 100644 --- a/src/Stubs/StubLoader.php +++ b/src/Stubs/StubLoader.php @@ -25,6 +25,12 @@ final class StubLoader $stubDirectory = __DIR__ . '/../../stubs'; + // stubs might not exists on composer install, to prevent PHPStorm duplicated confusion + // @see https://github.com/rectorphp/rector/issues/1899 + if (! file_exists($stubDirectory)) { + return; + } + $robotLoader = new RobotLoader(); $robotLoader->addDirectory($stubDirectory); $robotLoader->setTempDirectory(sys_get_temp_dir() . '/_rector_stubs');