Skip to content

Commit f345e8d

Browse files
committed
\LastDragon_ru\LaraASP\Dev\PhpStan\Larastan\Extension will not fail if no Larastan installed.
1 parent 8a501b8 commit f345e8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/dev/src/PhpStan/Larastan/Extension.php

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class Extension {
2828
* of the original file).
2929
*/
3030
public static function dump(): void {
31+
// Larastan?
32+
if (!self::hasLarastan()) {
33+
return;
34+
}
35+
3136
// Prepare
3237
$origin = self::getLarastanPath()->getFilePath('extension.neon');
3338
$target = self::getRootPath()->getFilePath('phpstan-larastan.neon');
@@ -141,6 +146,10 @@ private static function getRootPath(): DirectoryPath {
141146
return new DirectoryPath((string) getcwd());
142147
}
143148

149+
private static function hasLarastan(): bool {
150+
return InstalledVersions::isInstalled('larastan/larastan');
151+
}
152+
144153
private static function getLarastanPath(): DirectoryPath {
145154
return self::getPackagePath('larastan/larastan');
146155
}

0 commit comments

Comments
 (0)