Skip to content

Commit

Permalink
Fixed createMarkerNode for long constant strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 1, 2021
1 parent 61f1d20 commit 58b5959
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Type/Symfony/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function createMarkerNode(Expr $expr, Type $type, PrettyPrinterAbs
return new Expr\Variable(md5(sprintf(
'%s::%s',
$printer->prettyPrintExpr($expr),
$type->describe(VerbosityLevel::value())
$type->describe(VerbosityLevel::precise())
)));
}

Expand Down
5 changes: 5 additions & 0 deletions tests/Type/Symfony/ImpossibleCheckTypeMethodCallRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public function testExtension(): void
$this->analyse([__DIR__ . '/data/request_get_session.php'], []);
}

public function testBug178(): void
{
$this->analyse([__DIR__ . '/data/bug-178.php'], []);
}

public static function getAdditionalConfigFiles(): array
{
return [
Expand Down
17 changes: 17 additions & 0 deletions tests/Type/Symfony/data/bug-178.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Bug178;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class Foo extends AbstractController
{

public function doFoo(): void
{
if ($this->has('sonata.media.manager.category') && $this->has('sonata.media.manager.context')) {
// do stuff that requires both managers.
}
}

}

0 comments on commit 58b5959

Please sign in to comment.