Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
derrabus committed Aug 4, 2022
2 parents 498f452 + 94c3b38 commit 4c35aca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion UndefinedCallableHandler.php
Original file line number Diff line number Diff line change
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 @@ -96,6 +97,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 4c35aca

Please sign in to comment.