From f48bf141e96081b29b50a78245910441df0088d3 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 29 Dec 2022 16:05:44 +0100 Subject: [PATCH] Fix fatal error when autoloader open directories --- .../SourceLocator/FileReadTrapStreamWrapper.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php b/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php index 10e2f78e54..4a35d07ca2 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php +++ b/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php @@ -3,6 +3,7 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use PHPStan\ShouldNotHappenException; +use function is_dir; use function is_file; use function stat; use function stream_resolve_include_path; @@ -259,4 +260,14 @@ public function stream_set_option($option, $arg1, $arg2): bool return false; } + public function dir_opendir(string $path, int $options): bool + { + return is_dir($path); + } + + public function dir_readdir(): string + { + return ''; + } + }