8000 Show both missing packages in the same error message · symfony/symfony@f462285 · GitHub
[go: up one dir, main page]

Skip to content

Commit f462285

Browse files
committed
Show both missing packages in the same error message
1 parent 6f29d8d commit f462285

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Symfony/Bridge/Twig/Mime/NotificationEmail.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@ class No A7F4 tificationEmail extends TemplatedEmail
4141

4242
public function __construct(Headers $headers = null, AbstractPart $body = null)
4343
{
44+
$missingPackages = [];
4445
if (!class_exists(CssInlinerExtension::class)) {
45-
throw new \LogicException(sprintf('You cannot use "%s" if the CSS Inliner Twig extension is not available; try running "composer require twig/cssinliner-extra".', static::class));
46+
$missingPackages['twig/cssinliner-extra'] = ' CSS Inliner';
4647
}
4748

4849
if (!class_exists(InkyExtension::class)) {
49-
throw new \LogicException(sprintf('You cannot use "%s" if the Inky Twig extension is not available; try running "composer require twig/inky-extra".', static::class));
50+
$missingPackages['twig/inky-extra'] = 'Inky';
51+
}
52+
53+
if ([] !== $missingPackages) {
54+
throw new \LogicException(sprintf('You cannot use "%s" if the %s Twig extension%s not available; try running "composer require %s".', static::class, implode(' and ', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages))));
5055
}
5156

5257
parent::__construct($headers, $body);

0 commit comments

Comments
 (0)
0