phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Better support for autoloader edge cases

Open pprkut opened this issue 3 years ago • 0 comments

Support autoloaders that rely on the include path and don't check file existence before trying to include a file.

Autoloaders not checking file existence before trying to include the file need a proper response from stream_open. This is something that wouldn't happen with PHP based autoloaders, but C based autoloaders may rely on the return value of php_stream_open_for_zend_ex().

Autoloaders may not always know the exact physical location of the file they need to load, and instead rely on the availability of the file somewhere in the include path. In order for phpstan to also find those files, rather than just an is_file() check, it would also need to check availability in the include path with stream_resolve_include_path().

Fixes https://github.com/phpstan/phpstan/issues/7526, which also contains more background info.

pprkut avatar Jul 10 '22 18:07 pprkut