mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Stop analysis if parent class cannot be located
This commit is contained in:
parent
3ad6ec2e34
commit
daa923e243
@ -354,6 +354,16 @@ abstract class ClassLikeChecker extends SourceChecker implements StatementsSourc
|
|||||||
|
|
||||||
$storage = self::$storage[strtolower($fq_class_name)];
|
$storage = self::$storage[strtolower($fq_class_name)];
|
||||||
|
|
||||||
|
if (($this->class instanceof PhpParser\Node\Stmt\Class_ ||
|
||||||
|
$this->class instanceof PhpParser\Node\Stmt\Interface_
|
||||||
|
) &&
|
||||||
|
$this->parent_fq_class_name &&
|
||||||
|
!ClassLikeChecker::classOrInterfaceExists($this->parent_fq_class_name, $this->getFileChecker())
|
||||||
|
) {
|
||||||
|
// we should not normally get here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this instanceof ClassChecker && $this->class instanceof PhpParser\Node\Stmt\Class_) {
|
if ($this instanceof ClassChecker && $this->class instanceof PhpParser\Node\Stmt\Class_) {
|
||||||
$class_interfaces = ClassChecker::getInterfacesForClass($this->fq_class_name);
|
$class_interfaces = ClassChecker::getInterfacesForClass($this->fq_class_name);
|
||||||
|
|
||||||
|
@ -554,11 +554,11 @@ class ClassTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testMissingParentWithFunction()
|
public function testMissingParentWithFunction()
|
||||||
{
|
{
|
||||||
Config::getInstance()->setCustomErrorLevel('UndefinedClass', Config::REPORT_SUPPRESS);
|
Config::getInstance()->setCustomErrorLevel('UndefinedClass', Config::REPORT_SUPPRESS);
|
||||||
|
Config::getInstance()->setCustomErrorLevel('MissingReturnType', Config::REPORT_SUPPRESS);
|
||||||
|
|
||||||
$stmts = self::$parser->parse('<?php
|
$stmts = self::$parser->parse('<?php
|
||||||
class A extends B {
|
class B extends C {
|
||||||
/** @return void */
|
public function fooA() { }
|
||||||
public function foo() { }
|
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user