Skip to content

Commit 4c35aca

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [String] Fix snake conversion [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 [Serializer] Fix throwing right exception in ArrayDenormalizer with invalid type
2 parents 498f452 + 94c3b38 commit 4c35aca

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;
@@ -96,6 +97,12 @@ private static function onUndefined(string $name, string $type, string $componen
9697
return sprintf('Did you forget to %s? Unknown %s "%s".', self::FULL_STACK_ENABLE[$component], $type, $name);
9798
}
9899

99-
return sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name);
100+
$missingPackage = 'symfony/'.$component;
101+
102+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled($missingPackage)) {
103+
$missingPackage = 'symfony/twig-bundle';
104+
}
105+
106+
return sprintf('Did you forget to run "composer require %s"? Unknown %s "%s".', $missingPackage, $type, $name);
100107
}
101108
}

0 commit comments

Comments
 (0)