ircmaxell/php-cfg

Fatal error when function block is empty, or when declaring interfaces

Closed this issue · 3 comments

Example:

<?php
interface Iface  {
    function test();
}

Or

<?php
class NameOfClass  {
    function test() {

    }
    function doSomething() {
        echo "Hello World";
    }
}

Error:

Catchable fatal error: Argument 1 passed to PHPCfg\Visitor\DeclarationFinder::beforeTraverse() must be an instance of PHPCfg\Block, null given in /php-cfg/lib/PHPCfg/Visitor/DeclarationFinder.php on line 76
nikic commented

This should probably do it: 21c299b Need to write some visitor tests when back home.

Issue got regressed to another section of code:
Catchable fatal error: Argument 1 passed to PHPCfg\Traverser::traverseBlock() must be an instance of PHPCfg\Block, null given, called in php-cfg/lib/PHPCfg/Traverser.php on line 35 and defined in /php-cfg/lib/PHPCfg/Traverser.php on line 45

nikic commented

Next try: 1dbdfd2