Skip to content

Commit

Permalink
Merge branch '4.4' into 5.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Aug 3, 2022
2 parents 63b8a50 + 7d6e6db commit 94c3b38
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion UndefinedCallableHandler.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\Twig;

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

return sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name);
$missingPackage = 'symfony/'.$component;

if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled($missingPackage)) {
$missingPackage = 'symfony/twig-bundle';
}

return sprintf('Did you forget to run "composer require %s"? Unknown %s "%s".', $missingPackage, $type, $name);
}
}

0 comments on commit 94c3b38

Please sign in to comment.