mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Prevent type coercion from get_class output
This commit is contained in:
parent
af041abdcb
commit
97c0a94b42
@ -15,6 +15,7 @@ use Psalm\Type\Atomic\TFalse;
|
||||
use Psalm\Type\Atomic\TFloat;
|
||||
use Psalm\Type\Atomic\TGenericObject;
|
||||
use Psalm\Type\Atomic\TGenericParam;
|
||||
use Psalm\Type\Atomic\GetClassT;
|
||||
use Psalm\Type\Atomic\THtmlEscapedString;
|
||||
use Psalm\Type\Atomic\TInt;
|
||||
use Psalm\Type\Atomic\TLiteralClassString;
|
||||
@ -699,14 +700,19 @@ class TypeAnalyzer
|
||||
);
|
||||
}
|
||||
|
||||
if (($input_type_part instanceof TClassString || $input_type_part instanceof TLiteralClassString)
|
||||
if (($input_type_part instanceof TClassString
|
||||
|| $input_type_part instanceof TLiteralClassString)
|
||||
&& (get_class($container_type_part) === TString::class
|
||||
|| get_class($container_type_part) === TSingleLetter::class
|
||||
|| get_class($container_type_part) === Type\Atomic\GetClassT::class)
|
||||
|| get_class($container_type_part) === GetClassT::class)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($container_type_part instanceof TClassString && $input_type_part instanceof GetClassT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($container_type_part instanceof TString
|
||||
&& ($input_type_part instanceof TNumericString
|
||||
|| $input_type_part instanceof THtmlEscapedString)
|
||||
|
Loading…
Reference in New Issue
Block a user