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 0420d3c

Browse filesBrowse files
bug #47171 [TwigBridge] suggest to install the Twig bundle when the required component is already installed (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [TwigBridge] suggest to install the Twig bundle when the required component is already installed | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43560 | License | MIT | Doc PR | Commits ------- c203ef2 suggest to install the Twig bundle when the required component is already installed
2 parents f86f383 + c203ef2 commit 0420d3c
Copy full SHA for 0420d3c

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Open diff view settings
Collapse file

‎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.