Skip to content

TypeCombinator: Remove always true condition#5383

Merged
staabm merged 2 commits intophpstan:2.1.xfrom
staabm:rm-awl
Apr 2, 2026
Merged

TypeCombinator: Remove always true condition#5383
staabm merged 2 commits intophpstan:2.1.xfrom
staabm:rm-awl

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Apr 2, 2026

No description provided.

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

@staabm staabm merged commit 9c915ec into phpstan:2.1.x Apr 2, 2026
656 checks passed
@staabm staabm deleted the rm-awl branch April 2, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants