ovr / phpsa

Smart/Static Analyzer(sis) for PHP :bowtie::neckbeard:
Other
638 stars 77 forks source link

Fixed False positives [return.construct] Return in closure #287

Closed algo13 closed 7 years ago

algo13 commented 7 years ago

Notice: Method __construct cannot return a value. [return.construct]

class C
{
    public function __construct()
    {
        array_filter([], function ($var) { return false; });
        new class { function f(){ return 1; } };
        function f() { return 1; }
    }
}
ovr commented 7 years ago

Thanks for notice, I will review it ASAP and think a little bit more about this problem

ovr commented 7 years ago

Cherry-picked in master branch by https://github.com/ovr/phpsa/commit/c4e16ff1e49f9900d97655032173501669ab8911

Thanks