mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Add polyfill for Stringable interface
This commit is contained in:
parent
951c3715f7
commit
97dc34bed3
@ -1741,6 +1741,16 @@ class Config
|
||||
$core_generic_files[] = $ext_ds_path;
|
||||
}
|
||||
|
||||
if (!\interface_exists('Stringable', false) && $codebase->php_major_version >= 8) {
|
||||
$stringable_path = dirname(__DIR__, 2) . '/stubs/Stringable.php';
|
||||
|
||||
if (!file_exists($stringable_path)) {
|
||||
throw new \UnexpectedValueException('Cannot locate core generic classes');
|
||||
}
|
||||
|
||||
$core_generic_files[] = $stringable_path;
|
||||
}
|
||||
|
||||
$stub_files = array_merge($core_generic_files, $this->stub_files);
|
||||
|
||||
$phpstorm_meta_path = $this->base_dir . DIRECTORY_SEPARATOR . '.phpstorm.meta.php';
|
||||
|
6
stubs/Stringable.php
Normal file
6
stubs/Stringable.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
interface Stringable
|
||||
{
|
||||
function __toString() : string;
|
||||
}
|
Loading…
Reference in New Issue
Block a user