File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Doctrine \Persistence \ObjectManager ;
6
6
use PHPStan \Reflection \ReflectionProvider ;
7
- use function file_exists ;
7
+ use function is_file ;
8
8
use function is_readable ;
9
9
10
10
final class ObjectMetadataResolver
@@ -60,11 +60,18 @@ public function getObjectManager(): ?ObjectManager
60
60
61
61
private function loadObjectManager (string $ objectManagerLoader ): ?ObjectManager
62
62
{
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
+ ));
68
75
}
69
76
70
77
return require $ objectManagerLoader ;
You can’t perform that action at this time.
0 commit comments