-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
The type of the array is not detected properly as being non-empty-array
Code snippet that reproduces the problem
from https://phpstan.org/r/22de7a59-36aa-4daf-8048-81a49f86c1c2
<?php declare(strict_types = 1);
class HelloWorld
{
public function find(string $searchedValue, array $filters, bool $isAdmin): void
{
if ($searchedValue === '' || (!$isAdmin && empty($filters))) {
// skip
return;
}
if (!$isAdmin) {
// apply filters, no filters for admins
PHPStan\Testing\assertType('non-empty-array', $filters);
// error: 14 | Expected type non-empty-array, actual: array
}
}
}Expected output
The type should be non-empty-array
Did PHPStan help you today? Did it make you happy in any way?
Currently cleaning our level 6 baseline, it's a tedious work, but amazingly in parallel it's so enjoyable!
I love PHPStan! I'm currently writing a custom rule and it's when working on it that I discovered this bug 🙂
Reactions are currently unavailable