diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 564df2bc20d..43a17e853e1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1710,7 +1710,7 @@ parameters: - rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.' identifier: phpstanApi.instanceofType - count: 3 + count: 2 path: src/Type/TypeCombinator.php - @@ -1743,18 +1743,6 @@ parameters: count: 2 path: src/Type/TypeCombinator.php - - - rawMessage: Instanceof between PHPStan\Type\Constant\ConstantIntegerType and PHPStan\Type\Constant\ConstantIntegerType will always evaluate to true. - identifier: instanceof.alwaysTrue - count: 1 - path: src/Type/TypeCombinator.php - - - - rawMessage: Result of || is always true. - identifier: booleanOr.alwaysTrue - count: 1 - path: src/Type/TypeCombinator.php - - rawMessage: Doing instanceof PHPStan\Type\IntersectionType is error-prone and deprecated. identifier: phpstanApi.instanceofType diff --git a/src/Type/TypeCombinator.php b/src/Type/TypeCombinator.php index 4a98edb58b2..b4544a86627 100644 --- a/src/Type/TypeCombinator.php +++ b/src/Type/TypeCombinator.php @@ -793,10 +793,7 @@ private static function processArrayAccessoryTypes(array $arrayTypes): array continue; } if ($innerType instanceof HasOffsetType) { - $offset = $innerType->getOffsetType(); - if ($offset instanceof ConstantStringType || $offset instanceof ConstantIntegerType) { - $innerType = new HasOffsetValueType($offset, $arrayType->getIterableValueType()); - } + $innerType = new HasOffsetValueType($innerType->getOffsetType(), $arrayType->getIterableValueType()); } if ($innerType instanceof HasOffsetValueType) { $accessoryTypes[sprintf('hasOffsetValue(%s)', $innerType->getOffsetType()->describe(VerbosityLevel::cache()))][$i] = $innerType;