Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test
  • Loading branch information
VincentLanglet committed May 4, 2026
commit f9280edc375dc811363cce3e1535bba707852dfa
42 changes: 42 additions & 0 deletions tests/PHPStan/Analyser/nsrt/pr-5596.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Pr5596;

use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PHPStan\Analyser\Scope;

use function PHPStan\Testing\assertType;

class Test
{
private function whitelistAllowedCallables(
CallLike $node,
Scope $scope
): void
{
if ($node instanceof MethodCall && $node->name instanceof Identifier) {
assertType('PhpParser\Node\Expr\MethodCall', $node);
assertType('PhpParser\Node\Identifier', $node->name);
assertType('PhpParser\Node\Expr', $node->var);
} elseif ($node instanceof StaticCall && $node->name instanceof Identifier && $node->class instanceof Name) {
assertType('PhpParser\Node\Expr\StaticCall', $node);
assertType('PhpParser\Node\Identifier', $node->name);
assertType('PhpParser\Node\Name', $node->class);
} elseif ($node instanceof New_ && $node->class instanceof Name) {
assertType('PhpParser\Node\Expr\New_', $node);
assertType('PhpParser\Node\Name', $node->class);
} elseif ($node instanceof FuncCall && $node->name instanceof Name) {
assertType('PhpParser\Node\Expr\FuncCall', $node);
assertType('PhpParser\Node\Name', $node->name);
} elseif ($node instanceof FuncCall) {
assertType('PhpParser\Node\Expr\FuncCall', $node);
assertType('PhpParser\Node\Expr', $node->name);
}
}
}
Loading