mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #249 - get out of nested class
This commit is contained in:
parent
2e00fb19ee
commit
dbcec1be38
@ -408,7 +408,7 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
throw new \LogicException('$this->fq_classlike_names should not be empty');
|
||||
}
|
||||
|
||||
$fq_classlike_name = $this->fq_classlike_names[count($this->fq_classlike_names) - 1];
|
||||
$fq_classlike_name = array_pop($this->fq_classlike_names);
|
||||
|
||||
if (ClassLikeChecker::inPropertyMap($fq_classlike_name)) {
|
||||
$public_mapped_properties = ClassLikeChecker::getPropertyMap()[strtolower($fq_classlike_name)];
|
||||
|
@ -135,11 +135,27 @@ class Php70Test extends TestCase
|
||||
|
||||
$x = g($class->f());',
|
||||
],
|
||||
|
||||
'anonymousClassStatement' => [
|
||||
'<?php
|
||||
new class {};',
|
||||
],
|
||||
'anonymousClassTwoFunctions' => [
|
||||
'<?php
|
||||
interface I {}
|
||||
|
||||
class A
|
||||
{
|
||||
/** @var ?I */
|
||||
protected $i;
|
||||
|
||||
public function foo(): void
|
||||
{
|
||||
$this->i = new class implements I {};
|
||||
}
|
||||
|
||||
public function foo2() : void {} // commenting this line out fixes
|
||||
}',
|
||||
],
|
||||
'returnAnonymousClass' => [
|
||||
'<?php
|
||||
/** @return object */
|
||||
|
Loading…
x
Reference in New Issue
Block a user