feature #35689 [String] Transliterate & to and (Warxcell)

This PR was submitted for the 5.0 branch but it was squashed and merged into the 5.1-dev branch instead.

Discussion
----------

[String] Transliterate & to and

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | kind of
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

76ff984ab5 [String] Transliterate & to and
This commit is contained in:
Fabien Potencier 2020-02-13 16:04:05 +01:00
commit 7e0239b75e
2 changed files with 3 additions and 0 deletions

View File

@ -98,6 +98,7 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
return (new UnicodeString($string))
->ascii($transliterator)
->replace('@', $separator.'at'.$separator)
->replace('&', $separator.'and'.$separator)
->replaceMatches('/[^A-Za-z0-9]++/', $separator)
->trim($separator)
;

View File

@ -31,6 +31,8 @@ class SluggerTest extends TestCase
{
return [
['Стойността трябва да бъде лъжа', 'bg', 'Stoinostta-tryabva-da-bude-luzha'],
['You & I', 'en', 'You-and-I'],
['symfony@symfony.com', 'en', 'symfony-at-symfony-com'],
['Dieser Wert sollte größer oder gleich', 'de', 'Dieser-Wert-sollte-groesser-oder-gleich'],
['Dieser Wert sollte größer oder gleich', 'de_AT', 'Dieser-Wert-sollte-groesser-oder-gleich'],
['Αυτή η τιμή πρέπει να είναι ψευδής', 'el', 'Avti-i-timi-prepi-na-inai-psevdhis'],