We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With the option
ignoreInternalFunctionFalseReturn="false"
In
/** @var non-empty-string $foo */ $foo = PHP_EOL; $bar = explode($foo, $diff);
$bar is considered as always an array.
$bar = explode(PHP_EOL, $diff);
$bar is considered as array|false.
So I would say that explode is correctly supporting non-empty-string, but some constant are not considered as non-empty-string. I tried
public const FOO = 'foo';
Should these be non-empty-string ? https://psalm.dev/r/377464f1cd
non-empty-string
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php function foo(): void { /** @psalm-trace $a */ $a = PHP_EOL; return; }
Psalm output (using commit 3fb9e1c): INFO: Trace - 5:5 - $a: string INFO: UnusedVariable - 5:5 - $a is never referenced or the value is not used
Sorry, something went wrong.
a custom class constant public const FOO = 'foo';
This one should be inferred as literal "foo".
"foo"
The other two, I believe, would safe to assume non-empty.
Can be inherited and change value in the child
public const FOO = 'foo'; Can be inherited and change value in the child
If I use static::FOO, or if it's final, it should be ok no ?
Successfully merging a pull request may close this issue.
With the option
In
$bar is considered as always an array.
In
$bar is considered as array|false.
So I would say that explode is correctly supporting non-empty-string, but some constant are not considered as non-empty-string. I tried
public const FOO = 'foo';
Should these be
non-empty-string
?https://psalm.dev/r/377464f1cd
The text was updated successfully, but these errors were encountered: