Skip to content

Commit

Permalink
InClassMethodNode always contains PhpMethodFromParserNodeReflection
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 25, 2023
1 parent 0264f5b commit 01a7897
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Analyser/NodeScopeResolver.php
Expand Up @@ -110,7 +110,6 @@
use PHPStan\PhpDoc\Tag\VarTag;
use PHPStan\Reflection\Assertions;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\InitializerExprTypeResolver;
use PHPStan\Reflection\MethodReflection;
Expand All @@ -119,6 +118,7 @@
use PHPStan\Reflection\ParameterReflectionWithPhpDocs;
use PHPStan\Reflection\ParametersAcceptor;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection;
use PHPStan\Reflection\Php\PhpMethodReflection;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Rules\Properties\ReadWritePropertiesExtensionProvider;
Expand Down Expand Up @@ -544,7 +544,7 @@ private function processStmtNode(

if ($stmt->getAttribute('virtual', false) === false) {
$methodReflection = $methodScope->getFunction();
if (!$methodReflection instanceof ExtendedMethodReflection) {
if (!$methodReflection instanceof PhpMethodFromParserNodeReflection) {
throw new ShouldNotHappenException();
}
$nodeCallback(new InClassMethodNode($scope->getClassReflection(), $methodReflection, $stmt), $methodScope);
Expand Down
6 changes: 3 additions & 3 deletions src/Node/InClassMethodNode.php
Expand Up @@ -4,15 +4,15 @@

use PhpParser\Node;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection;

/** @api */
class InClassMethodNode extends Node\Stmt implements VirtualNode
{

public function __construct(
private ClassReflection $classReflection,
private ExtendedMethodReflection $methodReflection,
private PhpMethodFromParserNodeReflection $methodReflection,
private Node\Stmt\ClassMethod $originalNode,
)
{
Expand All @@ -24,7 +24,7 @@ public function getClassReflection(): ClassReflection
return $this->classReflection;
}

public function getMethodReflection(): ExtendedMethodReflection
public function getMethodReflection(): PhpMethodFromParserNodeReflection
{
return $this->methodReflection;
}
Expand Down

0 comments on commit 01a7897

Please sign in to comment.