The sniff Symfony.Functions.ReturnType.Invalid detects enclosures wrongly.
I have a function like this:
function test(array &$a): void
{
foreach ($a as &$b) {
usort(
$b,
function ($c, $d): int {
return (int)$c['sort'] <=> (int)$d['sort'];
}
);
}
}
The function's returntype is void, but the closure's returntype is int. However, the sniff fails on the closure's return line, with the following message: "Use return null; when a function explicitlyreturns null values and use return; when the function returns void values"
The sniff Symfony.Functions.ReturnType.Invalid detects enclosures wrongly.
I have a function like this:
The function's returntype is void, but the closure's returntype is int. However, the sniff fails on the closure's return line, with the following message: "Use return null; when a function explicitlyreturns null values and use return; when the function returns void values"