mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +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)];
|
||||
|
||||
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_) {
|
||||
$class_interfaces = ClassChecker::getInterfacesForClass($this->fq_class_name);
|
||||
|
||||
|
@ -554,11 +554,11 @@ class ClassTest extends PHPUnit_Framework_TestCase
|
||||
public function testMissingParentWithFunction()
|
||||
{
|
||||
Config::getInstance()->setCustomErrorLevel('UndefinedClass', Config::REPORT_SUPPRESS);
|
||||
Config::getInstance()->setCustomErrorLevel('MissingReturnType', Config::REPORT_SUPPRESS);
|
||||
|
||||
$stmts = self::$parser->parse('<?php
|
||||
class A extends B {
|
||||
/** @return void */
|
||||
public function foo() { }
|
||||
class B extends C {
|
||||
public function fooA() { }
|
||||
}
|
||||
');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user