Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psalm forgets about unset assertion outside of if #8518

Open
danog opened this issue Sep 28, 2022 · 1 comment
Open

Psalm forgets about unset assertion outside of if #8518

danog opened this issue Sep 28, 2022 · 1 comment
Labels

Comments

@danog
Copy link
Collaborator

danog commented Sep 28, 2022

https://psalm.dev/r/2a90fda384

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/2a90fda384
<?php
/** @var non-empty-array<string|int, int> */
$test = ['test' => 0];
/** @var string|int */
$k = 'test';
if (isset($test[$k])) {
    unset($test[$k]);
	/** @psalm-trace $test */
}

/** @psalm-trace $test */
Psalm output (using commit 028ac7f):

INFO: Trace - 8:0 - $test: array<int|string, int>

INFO: Trace - 11:26 - $test: non-empty-array<int|string, int>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants