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

Suppressing "NoValue" should not treat subsequent code as unevaluated #10302

Closed
kkmuffme opened this issue Oct 21, 2023 · 1 comment · Fixed by #10303
Closed

Suppressing "NoValue" should not treat subsequent code as unevaluated #10302

kkmuffme opened this issue Oct 21, 2023 · 1 comment · Fixed by #10303

Comments

@kkmuffme
Copy link
Contributor

Using a slightly adjusted example from https://psalm.dev/docs/running_psalm/issues/NoValue/

https://psalm.dev/r/a1c3c38452

When suppressing NoValue it's clear that there is a value and subsequent code should not treat as if it returned, e.g. UnevaluatedCode, UnusedVariable

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/a1c3c38452
<?php

/**
 * @return never
 */
function foo() : void {}

/**
 * @psalm-suppress NoValue
 */
$a = foo();

$f = rand( $a, 5 );
Psalm output (using commit 75fcfe3):

ERROR: InvalidReturnType - 4:12 - foo is not expected to return any values but it does, either implicitly or explicitly

ERROR: UnevaluatedCode - 13:1 - Expressions after return/throw/continue

INFO: UnusedVariable - 11:1 - $a is never referenced or the value is not used

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 a pull request may close this issue.

1 participant