From c54b257dc9c85bc3fba732068a4dcfe16d65996b Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sat, 26 Oct 2024 13:08:01 +0200 Subject: [PATCH] Fix build --- phpstan-baseline.neon | 5 +++++ src/Type/TypeCombinator.php | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 050d8a1d2c..1bdc95b954 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -635,6 +635,11 @@ parameters: count: 2 path: src/Rules/RuleLevelHelper.php + - + message: "#^Doing instanceof PHPStan\\\\Type\\\\ObjectType is error\\-prone and deprecated\\. Use Type\\:\\:isObject\\(\\) or Type\\:\\:getObjectClassNames\\(\\) instead\\.$#" + count: 2 + path: src/Rules/RuleLevelHelper.php + - message: "#^Doing instanceof PHPStan\\\\Type\\\\ObjectWithoutClassType is error\\-prone and deprecated\\. Use Type\\:\\:isObject\\(\\) instead\\.$#" count: 1 diff --git a/src/Type/TypeCombinator.php b/src/Type/TypeCombinator.php index f1860d1abb..ccbb29f97b 100644 --- a/src/Type/TypeCombinator.php +++ b/src/Type/TypeCombinator.php @@ -813,7 +813,7 @@ private static function optimizeConstantArrays(array $types): array $innerValueType = $type->getValueTypes()[$i]; $generalizedValueType = TypeTraverser::map($innerValueType, static function (Type $type) use ($traverse): Type { - if ($type instanceof ArrayType || $type instanceof ConstantArrayType) { + if ($type instanceof ArrayType) { return TypeCombinator::intersect($type, new OversizedArrayType()); } @@ -853,8 +853,8 @@ private static function optimizeConstantArrays(array $types): array $eachIsList = false; } - $keyType = self::union(...array_values($keyTypes)); - $valueType = self::union(...array_values($valueTypes)); + $keyType = self::union(...$keyTypes); + $valueType = self::union(...$valueTypes); $arrayType = new ArrayType($keyType, $valueType); if ($eachIsList) {