ovr / phpsa

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

[Bug] StaticCall in Closure in namespace #288

Closed algo13 closed 7 years ago

algo13 commented 7 years ago
<?php
namespace A;
class C1
{
    public static function f1() {}
}
class C2
{
    public function f2()
    {
        $r = function() {
            C1::f1();
        };
    }
}
  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to a member function hasMethod() on null

$context->scope is null

ddmler commented 7 years ago

182 Lexty's comment is about the same problem I think.

ovr commented 7 years ago

@ddmler Looks like, working on it

ovr commented 7 years ago

@algo13 I think you can try with latest master, this commit https://github.com/ovr/phpsa/commit/b6226c6c90f91d43e6ec5ef6d761a0d9be6f9c89 should help to fix this bug

algo13 commented 7 years ago

@ovr Thank you! I did not interrupt with latest master.

But PHP7 Warning in src/Definition/RuntimeClassDefinition.php by 149c2d6

PHP Warning:  Declaration of PHPSA\Definition\RuntimeClassDefinition::hasProperty($name, $inherit = false)
should be compatible with PHPSA\Definition\ClassDefinition::hasProperty($name, $inherit = false, $isParent = true)

Thanks

ovr commented 7 years ago

@algo13 Thanks for report, fixed!

algo13 commented 7 years ago

@ovr Thanks for fixed!