Skip to content

Commit 58b5959

Browse files
committed
Fixed createMarkerNode for long constant strings
1 parent 61f1d20 commit 58b5959

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/Type/Symfony/Helper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static function createMarkerNode(Expr $expr, Type $type, PrettyPrinterAbs
1717
return new Expr\Variable(md5(sprintf(
1818
'%s::%s',
1919
$printer->prettyPrintExpr($expr),
20-
$type->describe(VerbosityLevel::value())
20+
$type->describe(VerbosityLevel::precise())
2121
)));
2222
}
2323

tests/Type/Symfony/ImpossibleCheckTypeMethodCallRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public function testExtension(): void
2121
$this->analyse([__DIR__ . '/data/request_get_session.php'], []);
2222
}
2323

24+
public function testBug178(): void
25+
{
26+
$this->analyse([__DIR__ . '/data/bug-178.php'], []);
27+
}
28+
2429
public static function getAdditionalConfigFiles(): array
2530
{
2631
return [

tests/Type/Symfony/data/bug-178.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Bug178;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6+
7+
class Foo extends AbstractController
8+
{
9+
10+
public function doFoo(): void
11+
{
12+
if ($this->has('sonata.media.manager.category') && $this->has('sonata.media.manager.context')) {
13+
// do stuff that requires both managers.
14+
}
15+
}
16+
17+
}

0 commit comments

Comments
 (0)