Skip to content

Commit e3c7ddc

Browse files
committed
minor #19323 [String] Remove confusing paragraph about withEmoji('strip') (smnandre)
This PR was squashed before being merged into the 7.0 branch. Discussion ---------- [String] Remove confusing paragraph about `withEmoji('strip')` The AsciiSlugger does remove every emoji from a given string per default without any external component or package, as they are not... ASCII. The paragraph added some confusion to the reader, implying that * AsciiSlugger did not work with emoji per default * the special locale + the Intl component was required So i suggest to purely remove it. Commits ------- 9f4b626 [String] Remove confusing paragraph about `withEmoji('strip')`
2 parents 85e938b + 9f4b626 commit e3c7ddc

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

components/intl.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,15 @@ platforms::
424424
$transliterator->transliterate('Menus with 🥗 or 🧆');
425425
// => 'Menus with :green_salad: or :falafel:'
426426

427+
Furthermore the ``EmojiTransliterator`` provides a special ``strip`` locale
428+
that removes all the emojis from a string::
429+
430+
use Symfony\Component\Intl\Transliterator\EmojiTransliterator;
431+
432+
$transliterator = EmojiTransliterator::create('strip');
433+
$transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁');
434+
// => 'Hey! Happy Birthday!'
435+
427436
.. tip::
428437

429438
Combine this emoji transliterator with the :ref:`Symfony String slugger <string-slugger-emoji>`

components/string.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,6 @@ from GitHub or Slack, use the first argument of ``withEmoji()`` method::
589589
$slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁');
590590
// $slug = 'a-smiley-cat-black-cat-and-a-lion';
591591

592-
If you want to strip emojis from slugs, use the special ``strip`` locale::
593-
594-
use Symfony\Component\String\Slugger\AsciiSlugger;
595-
596-
$slugger = new AsciiSlugger();
597-
$slugger = $slugger->withEmoji('strip');
598-
599-
$slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁');
600-
// $slug = 'a-and-a';
601-
602592
.. _string-inflector:
603593

604594
Inflector

0 commit comments

Comments
 (0)