Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c203ef2

Browse filesBrowse files
committed
suggest to install the Twig bundle when the required component is already installed
1 parent f86f383 commit c203ef2
Copy full SHA for c203ef2

File tree

1 file changed

+8
-1
lines changed
Filter options

1 file changed

+8
-1
lines changed

‎src/Symfony/Bridge/Twig/UndefinedCallableHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/UndefinedCallableHandler.php
+8-1Lines 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

@@ -93,6 +94,12 @@ private static function onUndefined(string $name, string $type, string $componen
9394
throw new SyntaxError(sprintf('Did you forget to %s? Unknown %s "%s".', self::FULL_STACK_ENABLE[$component], $type, $name));
9495
}
9596

96-
throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name));
97+
$missingPackage = 'symfony/'.$component;
98+
99+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled($missingPackage)) {
100+
$missingPackage = 'symfony/twig-bundle';
101+
}
102+
103+
throw new SyntaxError(sprintf('Did you forget to run "composer require %s"? Unknown %s "%s".', $missingPackage, $type, $name));
97104
}
98105
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.