File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3
3
namespace PHPStan \Stubs \Doctrine ;
4
4
5
5
use Composer \InstalledVersions ;
6
+ use OutOfBoundsException ;
6
7
use PHPStan \BetterReflection \Reflector \Exception \IdentifierNotFound ;
7
8
use PHPStan \BetterReflection \Reflector \Reflector ;
8
9
use PHPStan \PhpDoc \StubFilesExtension ;
10
+ use function class_exists ;
9
11
use function dirname ;
10
12
use function strpos ;
11
13
@@ -61,9 +63,13 @@ public function getFiles(): array
61
63
$ files [] = $ stubsDir . '/ServiceEntityRepository.stub ' ;
62
64
}
63
65
64
- $ collectionVersion = class_exists (InstalledVersions::class)
65
- ? InstalledVersions::getVersion ('doctrine/collections ' )
66
- : null ;
66
+ try {
67
+ $ collectionVersion = class_exists (InstalledVersions::class)
68
+ ? InstalledVersions::getVersion ('doctrine/collections ' )
69
+ : null ;
70
+ } catch (OutOfBoundsException $ e ) {
71
+ $ collectionVersion = null ;
72
+ }
67
73
if ($ collectionVersion !== null && strpos ($ collectionVersion , '1. ' ) === 0 ) {
68
74
$ files [] = $ stubsDir . '/Collections/Collection1.stub ' ;
69
75
} else {
You can’t perform that action at this time.
0 commit comments