Skip to content

Commit 94c3b38

Browse files
Merge branch '4.4' into 5.4
* 4.4: [DowCrawler] Fix locale-sensitivity of whitespace normalization suggest to install the Twig bundle when the required component is already installed Update PULL_REQUEST_TEMPLATE.md
2 parents 63b8a50 + 7d6e6db commit 94c3b38

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

UndefinedCallableHandler.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig;
1313

14+
use Composer\InstalledVersions;
1415
use Symfony\Bundle\FullStack;
1516
use Twig\Error\SyntaxError;
1617
use Twig\TwigFilter;
@@ -102,6 +103,12 @@ private static function onUndefined(string $name, string $type, string $componen
102103
return sprintf('Did you forget to %s? Unknown %s "%s".', self::FULL_STACK_ENABLE[$component], $type, $name);
103104
}
104105

105-
return sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name);
106+
$missingPackage = 'symfony/'.$component;
107+
108+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled($missingPackage)) {
109+
$missingPackage = 'symfony/twig-bundle';
110+
}
111+
112+
return sprintf('Did you forget to run "composer require %s"? Unknown %s "%s".', $missingPackage, $type, $name);
106113
}
107114
}

0 commit comments

Comments
 (0)