Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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

-
Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/Type/TypeCombinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HasOffsetType->getOffsetType() is typed to return ConstantStringType|ConstantIntegerType

}
if ($innerType instanceof HasOffsetValueType) {
$accessoryTypes[sprintf('hasOffsetValue(%s)', $innerType->getOffsetType()->describe(VerbosityLevel::cache()))][$i] = $innerType;
Expand Down
Loading