Skip to content

Commit f553432

Browse files
committed
Fix
1 parent ff0b69a commit f553432

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

conf/config.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ services:
434434
usedAttributes:
435435
lines: %featureToggles.phpDocParserIncludeLines%
436436

437+
-
438+
class: PHPStan\PhpDocParser\Printer\Printer
439+
437440
-
438441
class: PHPStan\PhpDoc\ConstExprParserFactory
439442
arguments:

src/Rules/Debug/DumpPhpDocTypeRule.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use PhpParser\Node;
66
use PHPStan\Analyser\Scope;
7+
use PHPStan\PhpDocParser\Printer\Printer;
8+
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
79
use PHPStan\Reflection\ReflectionProvider;
810
use PHPStan\Rules\Rule;
911
use PHPStan\Rules\RuleErrorBuilder;
@@ -17,7 +19,7 @@
1719
final class DumpPhpDocTypeRule implements Rule
1820
{
1921

20-
public function __construct(private ReflectionProvider $reflectionProvider)
22+
public function __construct(private ReflectionProvider $reflectionProvider, private Printer $printer)
2123
{
2224
}
2325

@@ -49,7 +51,7 @@ public function processNode(Node $node, Scope $scope): array
4951
RuleErrorBuilder::message(
5052
sprintf(
5153
'Dumped type: %s',
52-
$scope->getType($node->getArgs()[0]->value)->toPhpDocNode(),
54+
$this->printer->print($scope->getType($node->getArgs()[0]->value)->toPhpDocNode()),
5355
),
5456
)->nonIgnorable()->identifier('phpstan.dumpPhpDocType')->build(),
5557
];

tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Rules\Debug;
44

5+
use PHPStan\PhpDocParser\Printer\Printer;
56
use PHPStan\Rules\Rule;
67
use PHPStan\Testing\RuleTestCase;
78

@@ -13,7 +14,7 @@ class DumpPhpDocTypeRuleTest extends RuleTestCase
1314

1415
protected function getRule(): Rule
1516
{
16-
return new DumpPhpDocTypeRule($this->createReflectionProvider());
17+
return new DumpPhpDocTypeRule($this->createReflectionProvider(), new Printer());
1718
}
1819

1920
public function testRuleSymbols(): void

0 commit comments

Comments
 (0)