Skip to content

Commit

Permalink
Merge branch '6.0' into 6.1
Browse files Browse the repository at this point in the history
* 6.0:
  [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 e16ffa5 + 4c35aca commit ec8da63
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 @@ -98,6 +99,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 ec8da63

Please sign in to comment.