diff --git a/composer.json b/composer.json index 6373d7aae2a2..4124d90a529c 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,6 @@ "symfony/http-client": "self.version", "symfony/http-foundation": "self.version", "symfony/http-kernel": "self.version", - "symfony/inflector": "self.version", "symfony/intl": "self.version", "symfony/ldap": "self.version", "symfony/lock": "self.version", diff --git a/src/Symfony/Component/Inflector/.gitattributes b/src/Symfony/Component/Inflector/.gitattributes deleted file mode 100644 index 84c7add058fb..000000000000 --- a/src/Symfony/Component/Inflector/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/Tests export-ignore -/phpunit.xml.dist export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore diff --git a/src/Symfony/Component/Inflector/.gitignore b/src/Symfony/Component/Inflector/.gitignore deleted file mode 100644 index c49a5d8df5c6..000000000000 --- a/src/Symfony/Component/Inflector/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/src/Symfony/Component/Inflector/CHANGELOG.md b/src/Symfony/Component/Inflector/CHANGELOG.md deleted file mode 100644 index ee4098b57f1b..000000000000 --- a/src/Symfony/Component/Inflector/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -CHANGELOG -========= - -5.1.0 ------ - - * The component has been deprecated, use `EnglishInflector` from the String component instead. diff --git a/src/Symfony/Component/Inflector/Inflector.php b/src/Symfony/Component/Inflector/Inflector.php deleted file mode 100644 index ded9fbe6e03d..000000000000 --- a/src/Symfony/Component/Inflector/Inflector.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Inflector; - -use Symfony\Component\String\Inflector\EnglishInflector; - -trigger_deprecation('symfony/inflector', '5.1', 'The "%s" class is deprecated, use "%s" instead.', Inflector::class, EnglishInflector::class); - -/** - * Converts words between singular and plural forms. - * - * @author Bernhard Schussek - * - * @deprecated since Symfony 5.1, use Symfony\Component\String\Inflector\EnglishInflector instead. - */ -final class Inflector -{ - private static $englishInflector; - - /** - * This class should not be instantiated. - */ - private function __construct() - { - } - - /** - * Returns the singular form of a word. - * - * If the method can't determine the form with certainty, an array of the - * possible singulars is returned. - * - * @param string $plural A word in plural form - * - * @return string|array The singular form or an array of possible singular forms - */ - public static function singularize(string $plural) - { - if (1 === \count($singulars = self::getEnglishInflector()->singularize($plural))) { - return $singulars[0]; - } - - return $singulars; - } - - /** - * Returns the plural form of a word. - * - * If the method can't determine the form with certainty, an array of the - * possible plurals is returned. - * - * @param string $singular A word in singular form - * - * @return string|array The plural form or an array of possible plural forms - */ - public static function pluralize(string $singular) - { - if (1 === \count($plurals = self::getEnglishInflector()->pluralize($singular))) { - return $plurals[0]; - } - - return $plurals; - } - - private static function getEnglishInflector(): EnglishInflector - { - if (!self::$englishInflector) { - self::$englishInflector = new EnglishInflector(); - } - - return self::$englishInflector; - } -} diff --git a/src/Symfony/Component/Inflector/LICENSE b/src/Symfony/Component/Inflector/LICENSE deleted file mode 100644 index 28c5b8066c3c..000000000000 --- a/src/Symfony/Component/Inflector/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012-2021 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Component/Inflector/Tests/InflectorTest.php b/src/Symfony/Component/Inflector/Tests/InflectorTest.php deleted file mode 100644 index aa223c40bd85..000000000000 --- a/src/Symfony/Component/Inflector/Tests/InflectorTest.php +++ /dev/null @@ -1,344 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Inflector\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Inflector\Inflector; - -/** - * @group legacy - */ -class InflectorTest extends TestCase -{ - public function singularizeProvider() - { - // see http://english-zone.com/spelling/plurals.html - // see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English - return [ - ['accesses', 'access'], - ['addresses', 'address'], - ['agendas', 'agenda'], - ['alumnae', 'alumna'], - ['alumni', 'alumnus'], - ['analyses', ['analys', 'analyse', 'analysis']], - ['antennae', 'antenna'], - ['antennas', 'antenna'], - ['appendices', ['appendex', 'appendix', 'appendice']], - ['arches', ['arch', 'arche']], - ['atlases', ['atlas', 'atlase', 'atlasis']], - ['axes', ['ax', 'axe', 'axis']], - ['babies', 'baby'], - ['bacteria', ['bacterion', 'bacterium']], - ['bases', ['bas', 'base', 'basis']], - ['batches', ['batch', 'batche']], - ['beaux', 'beau'], - ['bees', 'bee'], - ['boxes', 'box'], - ['boys', 'boy'], - ['bureaus', 'bureau'], - ['bureaux', 'bureau'], - ['buses', ['bus', 'buse', 'busis']], - ['bushes', ['bush', 'bushe']], - ['calves', ['calf', 'calve', 'calff']], - ['cars', 'car'], - ['cassettes', ['cassett', 'cassette']], - ['caves', ['caf', 'cave', 'caff']], - ['chateaux', 'chateau'], - ['cheeses', ['chees', 'cheese', 'cheesis']], - ['children', 'child'], - ['circuses', ['circus', 'circuse', 'circusis']], - ['cliffs', 'cliff'], - ['committee', 'committee'], - ['crises', ['cris', 'crise', 'crisis']], - ['criteria', ['criterion', 'criterium']], - ['cups', 'cup'], - ['coupons', 'coupon'], - ['data', 'data'], - ['days', 'day'], - ['discos', 'disco'], - ['devices', ['devex', 'devix', 'device']], - ['drives', 'drive'], - ['drivers', 'driver'], - ['dwarves', ['dwarf', 'dwarve', 'dwarff']], - ['echoes', ['echo', 'echoe']], - ['edges', 'edge'], - ['elves', ['elf', 'elve', 'elff']], - ['emphases', ['emphas', 'emphase', 'emphasis']], - ['employees', 'employee'], - ['faxes', 'fax'], - ['fees', 'fee'], - ['feet', 'foot'], - ['feedback', 'feedback'], - ['foci', 'focus'], - ['focuses', ['focus', 'focuse', 'focusis']], - ['formulae', 'formula'], - ['formulas', 'formula'], - ['conspectuses', 'conspectus'], - ['fungi', 'fungus'], - ['funguses', ['fungus', 'funguse', 'fungusis']], - ['garages', ['garag', 'garage']], - ['geese', 'goose'], - ['halves', ['half', 'halve', 'halff']], - ['hats', 'hat'], - ['heroes', ['hero', 'heroe']], - ['hippopotamuses', ['hippopotamus', 'hippopotamuse', 'hippopotamusis']], //hippopotami - ['hoaxes', 'hoax'], - ['hooves', ['hoof', 'hoove', 'hooff']], - ['houses', ['hous', 'house', 'housis']], - ['indexes', 'index'], - ['indices', ['index', 'indix', 'indice']], - ['ions', 'ion'], - ['irises', ['iris', 'irise', 'irisis']], - ['kisses', 'kiss'], - ['knives', 'knife'], - ['lamps', 'lamp'], - ['lessons', 'lesson'], - ['leaves', ['leaf', 'leave', 'leaff']], - ['lice', 'louse'], - ['lives', 'life'], - ['matrices', ['matrex', 'matrix', 'matrice']], - ['matrixes', 'matrix'], - ['men', 'man'], - ['mice', 'mouse'], - ['moves', 'move'], - ['movies', 'movie'], - ['nebulae', 'nebula'], - ['neuroses', ['neuros', 'neurose', 'neurosis']], - ['news', 'news'], - ['oases', ['oas', 'oase', 'oasis']], - ['objectives', 'objective'], - ['oxen', 'ox'], - ['parties', 'party'], - ['people', 'person'], - ['persons', 'person'], - ['phenomena', ['phenomenon', 'phenomenum']], - ['photos', 'photo'], - ['pianos', 'piano'], - ['plateaux', 'plateau'], - ['poisons', 'poison'], - ['poppies', 'poppy'], - ['prices', ['prex', 'prix', 'price']], - ['quizzes', 'quiz'], - ['radii', 'radius'], - ['roofs', 'roof'], - ['roses', ['ros', 'rose', 'rosis']], - ['sandwiches', ['sandwich', 'sandwiche']], - ['scarves', ['scarf', 'scarve', 'scarff']], - ['schemas', 'schema'], //schemata - ['seasons', 'season'], - ['selfies', 'selfie'], - ['series', 'series'], - ['services', 'service'], - ['sheriffs', 'sheriff'], - ['shoes', ['sho', 'shoe']], - ['species', 'species'], - ['spies', 'spy'], - ['staves', ['staf', 'stave', 'staff']], - ['stories', 'story'], - ['strata', ['straton', 'stratum']], - ['suitcases', ['suitcas', 'suitcase', 'suitcasis']], - ['syllabi', 'syllabus'], - ['tags', 'tag'], - ['teeth', 'tooth'], - ['theses', ['thes', 'these', 'thesis']], - ['thieves', ['thief', 'thieve', 'thieff']], - ['treasons', 'treason'], - ['trees', 'tree'], - ['waltzes', ['waltz', 'waltze']], - ['wives', 'wife'], - - // test casing: if the first letter was uppercase, it should remain so - ['Men', 'Man'], - ['GrandChildren', 'GrandChild'], - ['SubTrees', 'SubTree'], - - // Known issues - //['insignia', 'insigne'], - //['insignias', 'insigne'], - //['rattles', 'rattle'], - ]; - } - - public function pluralizeProvider() - { - // see http://english-zone.com/spelling/plurals.html - // see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English - return [ - ['access', 'accesses'], - ['address', 'addresses'], - ['agenda', 'agendas'], - ['alumnus', 'alumni'], - ['analysis', 'analyses'], - ['antenna', 'antennas'], //antennae - ['appendix', ['appendicies', 'appendixes']], - ['arch', 'arches'], - ['atlas', 'atlases'], - ['axe', 'axes'], - ['baby', 'babies'], - ['bacterium', 'bacteria'], - ['base', 'bases'], - ['batch', 'batches'], - ['beau', ['beaus', 'beaux']], - ['bee', 'bees'], - ['box', 'boxes'], - ['boy', 'boys'], - ['bureau', ['bureaus', 'bureaux']], - ['bus', 'buses'], - ['bush', 'bushes'], - ['calf', ['calfs', 'calves']], - ['car', 'cars'], - ['cassette', 'cassettes'], - ['cave', 'caves'], - ['chateau', ['chateaus', 'chateaux']], - ['cheese', 'cheeses'], - ['child', 'children'], - ['circus', 'circuses'], - ['cliff', 'cliffs'], - ['committee', 'committees'], - ['crisis', 'crises'], - ['criteria', 'criterion'], - ['cup', 'cups'], - ['coupon', 'coupons'], - ['data', 'data'], - ['day', 'days'], - ['disco', 'discos'], - ['device', 'devices'], - ['drive', 'drives'], - ['driver', 'drivers'], - ['dwarf', ['dwarfs', 'dwarves']], - ['echo', 'echoes'], - ['edge', 'edges'], - ['elf', ['elfs', 'elves']], - ['emphasis', 'emphases'], - ['fax', ['facies', 'faxes']], - ['feedback', 'feedback'], - ['focus', 'focuses'], - ['foot', 'feet'], - ['formula', 'formulas'], //formulae - ['conspectus', 'conspectuses'], - ['fungus', 'fungi'], - ['garage', 'garages'], - ['goose', 'geese'], - ['half', ['halfs', 'halves']], - ['hat', 'hats'], - ['hero', 'heroes'], - ['hippopotamus', 'hippopotami'], //hippopotamuses - ['hoax', 'hoaxes'], - ['hoof', ['hoofs', 'hooves']], - ['house', 'houses'], - ['index', ['indicies', 'indexes']], - ['ion', 'ions'], - ['iris', 'irises'], - ['kiss', 'kisses'], - ['knife', 'knives'], - ['lamp', 'lamps'], - ['leaf', ['leafs', 'leaves']], - ['lesson', 'lessons'], - ['life', 'lives'], - ['louse', 'lice'], - ['man', 'men'], - ['matrix', ['matricies', 'matrixes']], - ['mouse', 'mice'], - ['move', 'moves'], - ['movie', 'movies'], - ['nebula', 'nebulae'], - ['neurosis', 'neuroses'], - ['news', 'news'], - ['oasis', 'oases'], - ['objective', 'objectives'], - ['ox', 'oxen'], - ['party', 'parties'], - ['person', ['persons', 'people']], - ['phenomenon', 'phenomena'], - ['photo', 'photos'], - ['piano', 'pianos'], - ['plateau', ['plateaus', 'plateaux']], - ['poison', 'poisons'], - ['poppy', 'poppies'], - ['price', 'prices'], - ['quiz', 'quizzes'], - ['radius', 'radii'], - ['roof', ['roofs', 'rooves']], - ['rose', 'roses'], - ['sandwich', 'sandwiches'], - ['scarf', ['scarfs', 'scarves']], - ['schema', 'schemas'], //schemata - ['season', 'seasons'], - ['selfie', 'selfies'], - ['series', 'series'], - ['service', 'services'], - ['sheriff', 'sheriffs'], - ['shoe', 'shoes'], - ['species', 'species'], - ['spy', 'spies'], - ['staff', 'staves'], - ['story', 'stories'], - ['stratum', 'strata'], - ['suitcase', 'suitcases'], - ['syllabus', 'syllabi'], - ['tag', 'tags'], - ['thief', ['thiefs', 'thieves']], - ['tooth', 'teeth'], - ['treason', 'treasons'], - ['tree', 'trees'], - ['waltz', 'waltzes'], - ['wife', 'wives'], - - // test casing: if the first letter was uppercase, it should remain so - ['Man', 'Men'], - ['GrandChild', 'GrandChildren'], - ['SubTree', 'SubTrees'], - ]; - } - - /** - * @dataProvider singularizeProvider - */ - public function testSingularize($plural, $expectedSingular) - { - $singular = Inflector::singularize($plural); - if (\is_string($expectedSingular) && \is_array($singular)) { - $this->fail("--- Expected\n`string`: ".$expectedSingular."\n+++ Actual\n`array`: ".implode(', ', $singular)); - } elseif (\is_array($expectedSingular) && \is_string($singular)) { - $this->fail("--- Expected\n`array`: ".implode(', ', $expectedSingular)."\n+++ Actual\n`string`: ".$singular); - } - - $this->assertEquals($expectedSingular, $singular); - } - - /** - * @dataProvider pluralizeProvider - */ - public function testPluralize($singular, $expectedPlural) - { - $plural = Inflector::pluralize($singular); - if (\is_string($expectedPlural) && \is_array($plural)) { - $this->fail("--- Expected\n`string`: ".$expectedPlural."\n+++ Actual\n`array`: ".implode(', ', $plural)); - } elseif (\is_array($expectedPlural) && \is_string($plural)) { - $this->fail("--- Expected\n`array`: ".implode(', ', $expectedPlural)."\n+++ Actual\n`string`: ".$plural); - } - - $this->assertEquals($expectedPlural, $plural); - } - - public function testPluralizeEmptyString() - { - $plural = Inflector::pluralize(''); - $this->assertSame('', $plural); - } - - public function testSingularizeEmptyString() - { - $singular = Inflector::singularize(''); - $this->assertSame('', $singular); - } -} diff --git a/src/Symfony/Component/Inflector/composer.json b/src/Symfony/Component/Inflector/composer.json deleted file mode 100644 index 4b532440e00b..000000000000 --- a/src/Symfony/Component/Inflector/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "symfony/inflector", - "type": "library", - "description": "Converts words between their singular and plural forms (English only)", - "keywords": [ - "string", - "inflection", - "singularize", - "pluralize", - "words", - "symfony" - ], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.0.2", - "symfony/deprecation-contracts": "^2.1", - "symfony/string": "^5.4|^6.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Inflector\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/src/Symfony/Component/Inflector/phpunit.xml.dist b/src/Symfony/Component/Inflector/phpunit.xml.dist deleted file mode 100644 index c0894023560d..000000000000 --- a/src/Symfony/Component/Inflector/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - -