Exakat\Analyzer\Functions\UselessReturn::analyze PHP Method

analyze() public method

public analyze ( )
    public function analyze()
    {
        // return in special functions
        $this->atomIs('Function')->hasClassTrait()->outIs('NAME')->codeIs(array('__construct', '__destruct', '__set', '__clone', '__unset', '__wakeup'), true)->inIs('NAME')->outIs('BLOCK')->atomInside('Return')->outIs('RETURN')->atomIsNot('Void')->back('first');
        $this->prepareQuery();
        // function that finally returns void. (the last return is useless)
        $this->atomIs('Function')->hasNoClassTrait()->outIs('BLOCK')->outWithRank('ELEMENT', 'last')->atomIs('Return')->outIs('RETURN')->atomIs('Void')->back('first');
        $this->prepareQuery();
        // @todo : spot such functions
        //Also `__autoload`, methods used for autoloading and methods registered for shutdown, have no need to return anything.
    }
UselessReturn