Skip to content

Commit

Permalink
InFunctionNode always contains PhpFunctionFromParserNodeReflection
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 25, 2023
1 parent 01a7897 commit e864b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
use PHPStan\Reflection\ParameterReflectionWithPhpDocs;
use PHPStan\Reflection\ParametersAcceptor;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection;
use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection;
use PHPStan\Reflection\Php\PhpMethodReflection;
use PHPStan\Reflection\ReflectionProvider;
Expand Down Expand Up @@ -443,7 +444,7 @@ private function processStmtNode(
$phpDocParameterOutTypes,
);
$functionReflection = $functionScope->getFunction();
if (!$functionReflection instanceof FunctionReflection) {
if (!$functionReflection instanceof PhpFunctionFromParserNodeReflection) {
throw new ShouldNotHappenException();
}

Expand Down
6 changes: 3 additions & 3 deletions src/Node/InFunctionNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
namespace PHPStan\Node;

use PhpParser\Node;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection;

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

public function __construct(
private FunctionReflection $functionReflection,
private PhpFunctionFromParserNodeReflection $functionReflection,
private Node\Stmt\Function_ $originalNode,
)
{
parent::__construct($originalNode->getAttributes());
}

public function getFunctionReflection(): FunctionReflection
public function getFunctionReflection(): PhpFunctionFromParserNodeReflection
{
return $this->functionReflection;
}
Expand Down

0 comments on commit e864b24

Please # to comment.