File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 44
55use Doctrine \Persistence \ObjectManager ;
66use PHPStan \Reflection \ReflectionProvider ;
7- use function file_exists ;
7+ use function is_file ;
88use function is_readable ;
99
1010final class ObjectMetadataResolver
@@ -60,11 +60,18 @@ public function getObjectManager(): ?ObjectManager
6060
6161 private function loadObjectManager (string $ objectManagerLoader ): ?ObjectManager
6262 {
63- if (
64- !file_exists ($ objectManagerLoader )
65- || !is_readable ($ objectManagerLoader )
66- ) {
67- throw new \PHPStan \ShouldNotHappenException ('Object manager could not be loaded ' );
63+ if (!is_file ($ objectManagerLoader )) {
64+ throw new \PHPStan \ShouldNotHappenException (sprintf (
65+ 'Object manager could not be loaded: file "%s" does not exist ' ,
66+ $ objectManagerLoader
67+ ));
68+ }
69+
70+ if (!is_readable ($ objectManagerLoader )) {
71+ throw new \PHPStan \ShouldNotHappenException (sprintf (
72+ 'Object manager could not be loaded: file "%s" is not readable ' ,
73+ $ objectManagerLoader
74+ ));
6875 }
6976
7077 return require $ objectManagerLoader ;
You can’t perform that action at this time.
0 commit comments