From ad87c2e90553f57bc5391ebf78af1635d6d4e99c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 15 Mar 2024 12:15:05 +0100 Subject: [PATCH 1/2] Allow specifying flags to Codebase::isTypeContainedByType --- src/Psalm/Codebase.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index a02f61403..f812c63c1 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -47,6 +47,7 @@ use Psalm\Internal\Provider\FileReferenceProvider; use Psalm\Internal\Provider\FileStorageProvider; use Psalm\Internal\Provider\Providers; use Psalm\Internal\Provider\StatementsProvider; +use Psalm\Internal\Type\Comparator\TypeComparisonResult; use Psalm\Internal\Type\Comparator\UnionTypeComparator; use Psalm\Progress\Progress; use Psalm\Progress\VoidProgress; @@ -2352,9 +2353,22 @@ final class Codebase */ public function isTypeContainedByType( Union $input_type, - Union $container_type + Union $container_type, + bool $ignore_null = false, + bool $ignore_false = false, + bool $allow_interface_equality = false, + bool $allow_float_int_equality = true ): bool { - return UnionTypeComparator::isContainedBy($this, $input_type, $container_type); + return UnionTypeComparator::isContainedBy( + $this, + $input_type, + $container_type, + $ignore_null, + $ignore_false, + null, + $allow_interface_equality, + $allow_float_int_equality + ); } /** From b431e5fc730d61b8c84e81ebd38fa9acf01c2a02 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 15 Mar 2024 12:52:36 +0100 Subject: [PATCH 2/2] cs-fix --- src/Psalm/Codebase.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index f812c63c1..cdcda4598 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -47,7 +47,6 @@ use Psalm\Internal\Provider\FileReferenceProvider; use Psalm\Internal\Provider\FileStorageProvider; use Psalm\Internal\Provider\Providers; use Psalm\Internal\Provider\StatementsProvider; -use Psalm\Internal\Type\Comparator\TypeComparisonResult; use Psalm\Internal\Type\Comparator\UnionTypeComparator; use Psalm\Progress\Progress; use Psalm\Progress\VoidProgress; @@ -2367,7 +2366,7 @@ final class Codebase $ignore_false, null, $allow_interface_equality, - $allow_float_int_equality + $allow_float_int_equality, ); }