minor #37512 [String] Added a help message when translation-contracts is not installed (lyrixx)

This PR was submitted for the master branch but it was merged into the 5.0 branch instead.

Discussion
----------

[String] Added a help message when translation-contracts is not installed

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes and no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37060
| License       | MIT
| Doc PR        |

Commits
-------

904fb1ae21 [String] Added a help message when translation-contracts is not installed
This commit is contained in:
Nicolas Grekas 2020-07-08 10:26:32 +02:00
commit eae19f263a

View File

@ -15,6 +15,10 @@ use Symfony\Component\String\AbstractUnicodeString;
use Symfony\Component\String\UnicodeString;
use Symfony\Contracts\Translation\LocaleAwareInterface;
if (!interface_exists(LocaleAwareInterface::class)) {
throw new \LogicException('You cannot use the "Symfony\Component\String\Slugger\AsciiSlugger" as the "symfony/translation-contracts" package is not installed. Try running "composer require symfony/translation-contracts".');
}
/**
* @author Titouan Galopin <galopintitouan@gmail.com>
*