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
psalm-assert-if-false does not work as expected.
psalm-assert-if-false
The annotation's location (on interface or class directly) does not impact the result.
https://psalm.dev/r/c8e0097627
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php interface ContainerInterface { /** * @return list<int> */ public function getAll(): array; /** * @psalm-assert-if-false non-empty-list<int> $this->getAll() */ public function isEmpty(): bool; } class Container implements ContainerInterface { /** @var list<int> */ private array $storage; /** * @param list<int> $storage */ public function __construct(array $storage) { $this->storage = $storage; } public function getAll(): array { return $this->storage; } public function isEmpty(): bool { return 0 === \count($this->storage); } } /** * @param non-empty-list<int> $array */ function foo(array $array): int { return count($array); } $container = new Container([]); if (false === $container->isEmpty()) { foo($container->getAll()); }
Psalm output (using commit 16b24bd): ERROR: InvalidArgument - 51:9 - Argument 1 of foo expects non-empty-list<int>, but list<int> provided
Sorry, something went wrong.
No branches or pull requests
psalm-assert-if-false
does not work as expected.The annotation's location (on interface or class directly) does not impact the result.
https://psalm.dev/r/c8e0097627
The text was updated successfully, but these errors were encountered: