1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #6738 from orklah/generator_and_iterator

don't use is_a with user classes
This commit is contained in:
orklah 2021-10-26 19:28:17 +02:00 committed by GitHub
commit 6fba5eb554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ use Psalm\Type\Union;
use function array_merge;
use function array_values;
use function count;
use function is_a;
use function in_array;
use function reset;
use function strpos;
use function substr;
@ -469,6 +469,13 @@ class TemplateStandinTypeReplacer
$matching_atomic_types[$atomic_input_type->getId()] = $atomic_input_type;
continue;
}
if (in_array('Traversable', $classlike_storage->class_implements)
&& $base_type->value === 'Iterator'
) {
$matching_atomic_types[$atomic_input_type->getId()] = $atomic_input_type;
continue;
}
} catch (\InvalidArgumentException $e) {
// do nothing
}
@ -487,12 +494,6 @@ class TemplateStandinTypeReplacer
);
continue;
}
/** @var class-string $key may not always be true but class_exists on built in classes(Iterator) is wrong */
if (is_a($input_key, $key, true)) {
$matching_atomic_types[$atomic_input_type->getId()] = $atomic_input_type;
continue;
}
}
return array_values($matching_atomic_types);