You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
no-return is a "bottom type", this means it should be a subtype of all types. But for now it "contaminates" the return type of
any function and Psalm just thinks it must not return nothing at all, even if there are other non-bottom types in the union.
You can see where I have to use this type in practice in the following repo, which is a simple library for FP-ish Result type (Success or Error), and where I encountered this error: https://github.com/someniatko/php-result-type
The text was updated successfully, but these errors were encountered:
<?php/** @return int|no-return */functionreturnSomething(): int
{
return1;
}
Psalm output (using commit 39e61ae):
ERROR: InvalidReturnType - 3:13 - returnSomething is not expected to return any values but it does, either implicitly or explicitly
This is a minimal reproducer of the problem:
https://psalm.dev/r/3b5004a09a
no-return
is a "bottom type", this means it should be a subtype of all types. But for now it "contaminates" the return type ofany function and Psalm just thinks it must not return nothing at all, even if there are other non-bottom types in the union.
You can see where I have to use this type in practice in the following repo, which is a simple library for FP-ish Result type (Success or Error), and where I encountered this error:
https://github.com/someniatko/php-result-type
The text was updated successfully, but these errors were encountered: