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-return non-empty-list
in combination with @psalm-assert non-empty-list
does not work since version 3.8.2
#2636
Comments
Hey @smoench, can you reproduce the issue on https://psalm.dev ? |
I found these snippets: https://psalm.dev/r/2e692148a5<?php
class Assert {
/**
* @psalm-assert non-empty-list<mixed> $array
*
* @param mixed $_array
* @param string $_message
* @return void
*
* @throws InvalidArgumentException
*/
public static function isNonEmptyList($_array, $_message = '')
{
}
}
/**
* @psalm-param mixed $value
*
* @psalm-return non-empty-list<mixed>
*/
function consume($value): array
{
Assert::isNonEmptyList($value);
return $value;
}
|
https://psalm.dev/r/c53305ee8b (this one produces the described error report; the other snippet has an incorrect doc block) |
I found these snippets: https://psalm.dev/r/c53305ee8b<?php
class Assert {
/**
* @psalm-assert non-empty-list $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function isNonEmptyList($array, $message = ''): void
{
}
}
/**
* @psalm-param mixed $value
*
* @psalm-return non-empty-list<mixed>
*/
function consume($value): array
{
Assert::isNonEmptyList($value);
return $value;
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/webmozart/assert using psalm. With latest psalm version I got following error report:
Following code is being used (https://github.com/webmozart/assert/blob/master/tests/static-analysis/assert-isNonEmptyList.php)
to test (https://github.com/webmozart/assert/blob/master/src/Assert.php#L1736)
While I was wondering why it fails I could track down something has changed with psalm version 3.8.2. I could prove psalm is not reporting any error with version <3.8.2.
The text was updated successfully, but these errors were encountered: