1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Improve resilience of typechecker::isContainedBy

This commit is contained in:
Matthew Brown 2017-01-05 00:14:12 -05:00
parent 7609ca02c0
commit df941bd575
2 changed files with 4 additions and 2 deletions

View File

@ -699,10 +699,12 @@ class TypeChecker
$input_is_object = $input_type_part->isObjectType();
$container_is_object = $container_type_part->isObjectType();
if ($input_type_part->value === $container_type_part->value ||
if (strtolower($input_type_part->value) === strtolower($container_type_part->value) ||
(
$input_is_object &&
$container_is_object &&
!$input_type_part->isObject() &&
ClassChecker::classExists($input_type_part->value, $file_checker) &&
(
ClassChecker::classExtendsOrImplements(
$input_type_part->value,

View File

@ -386,7 +386,7 @@ class Config
require_once($path);
if (!ClassLikeChecker::classExtends($declared_classes[0], 'Psalm\\Checker\\FileChecker')) {
if (!\Psalm\Checker\ClassChecker::classExtends($declared_classes[0], 'Psalm\\Checker\\FileChecker')) {
throw new \InvalidArgumentException(
'Filetype handlers must extend \Psalm\Checker\FileChecker - ' . $path . ' does not'
);