File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 33namespace PHPStan \Node \Printer ;
44
55use PhpParser \Node \Expr ;
6+ use PHPStan \Node \MethodCallableNode ;
67
78/**
89 * @api
@@ -19,6 +20,9 @@ public function printExpr(Expr $expr): string
1920 /** @var string|null $exprString */
2021 $ exprString = $ expr ->getAttribute ('phpstan_cache_printer ' );
2122 if ($ exprString === null ) {
23+ if ($ expr instanceof MethodCallableNode) {
24+ $ expr = $ expr ->getOriginalNode ();
25+ }
2226 $ exprString = $ this ->printer ->prettyPrintExpr ($ expr );
2327 $ expr ->setAttribute ('phpstan_cache_printer ' , $ exprString );
2428 }
Original file line number Diff line number Diff line change @@ -3491,4 +3491,14 @@ public function testBug4801(): void
34913491 $ this ->analyse ([__DIR__ . '/data/bug-4801.php ' ], []);
34923492 }
34933493
3494+ public function testBug12246 (): void
3495+ {
3496+ $ this ->checkThisOnly = false ;
3497+ $ this ->checkNullables = false ;
3498+ $ this ->checkUnionTypes = false ;
3499+ $ this ->checkExplicitMixed = false ;
3500+
3501+ $ this ->analyse ([ __DIR__ . '/data/first_class_callable_do_while.php ' ], []);
3502+ }
3503+
34943504}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace FirstClassCallableInDoWhile ;
4+
5+ final class SomeFirstClassCallableInDoWhile
6+ {
7+ public function getSubscribedEvents ()
8+ {
9+ do {
10+
11+ } while ($ this ->textElement (...));
12+ }
13+
14+ public function textElement ()
15+ {
16+ return 1 ;
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments