Skip to content

Commit 46c970f

Browse files
staabmondrejmirtes
authored andcommitted
Fix fatal error when autoloader open directories
1 parent ab27d89 commit 46c970f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\Reflection\BetterReflection\SourceLocator;
44

55
use PHPStan\ShouldNotHappenException;
6+
use function is_dir;
67
use function is_file;
78
use function stat;
89
use function stream_resolve_include_path;
@@ -259,4 +260,14 @@ public function stream_set_option($option, $arg1, $arg2): bool
259260
return false;
260261
}
261262

263+
public function dir_opendir(string $path, int $options): bool
264+
{
265+
return is_dir($path);
266+
}
267+
268+
public function dir_readdir(): string
269+
{
270+
return '';
271+
}
272+
262273
}

0 commit comments

Comments
 (0)