djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
402 stars 102 forks source link

use return; when the function returns void values. #105

Closed wickedOne closed 6 years ago

wickedOne commented 7 years ago

this raises an error while it shouldn't:

public function foo($qux): void
{
    $bar = function ($baz) { return $baz + $qux; }
}
ZhukV commented 6 years ago

Clone is #119

podhy commented 6 years ago

same error even if using latest master branch

xalopp commented 6 years ago

Also get an error

 104 | ERROR | Use return null; when a function explicitly returns null values and use return; when the function returns void values (Symfony.Functions.ReturnType.Invalid)

with Version 3.4.0

for this piece of code:

function test(): void
{
    $t = function(): int {
        return 1;
    };
}