Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 15, 2025

analog #4440 but for isset($arr[$i])

closes phpstan/phpstan#13674

$types = $types->unionWith(
$this->create(
$var->var,
new NonEmptyArrayType(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm interessting.. for some reason this operation makes array loose their template type.

3) PHPStan\Rules\Methods\ReturnTypeRuleTest::testBug7511
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'
+'48: Method Bug7511\HelloWorld::computeForFrontByPosition() should return array<T of Bug7511\PositionEntityInterface&Bug7511\TgEntityInterface> but returns array<Bug7511\PositionEntityInterface&Bug7511\TgEntityInterface>.
 '

/Users/m.staab/dvl/phpstan-src/src/Testing/RuleTestCase.php:179
/Users/m.staab/dvl/phpstan-src/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php:759

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.

infer non-empty-list after isset($list[$i])

1 participant