From 5adc5992e150a45bf6a7c59bada5d79f46d0941a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 24 Jan 2023 15:02:24 +0100 Subject: [PATCH 1/7] Update license years (last time) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5c7ba05..f37c76b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2023 Fabien Potencier +Copyright (c) 2019-present 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 From 5a3ce20eb7fcc44f5ee7e69a94d45a4caaded182 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 30 Jan 2023 20:36:26 +0100 Subject: [PATCH 2/7] [String] Remove duplicates in fold maps --- AbstractUnicodeString.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AbstractUnicodeString.php b/AbstractUnicodeString.php index 1bc6f88..80b8326 100644 --- a/AbstractUnicodeString.php +++ b/AbstractUnicodeString.php @@ -37,8 +37,8 @@ abstract class AbstractUnicodeString extends AbstractString private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; // the subset of folded case mappings that is not in lower case mappings - private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; - private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; + private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; + private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; // the subset of upper case mappings that map one code point to many code points private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ']; From 42bbb84177c254b1dde530db13bafdbe7b46c709 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 14 Dec 2022 15:42:16 +0100 Subject: [PATCH 3/7] Migrate to `static` data providers using `rector/rector` --- Tests/AbstractAsciiTestCase.php | 2 +- Tests/FunctionsTest.php | 6 +++--- Tests/Inflector/EnglishInflectorTest.php | 4 ++-- Tests/Inflector/FrenchInflectorTest.php | 2 +- Tests/Slugger/AsciiSluggerTest.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/AbstractAsciiTestCase.php b/Tests/AbstractAsciiTestCase.php index a0cf206..d25fbde 100644 --- a/Tests/AbstractAsciiTestCase.php +++ b/Tests/AbstractAsciiTestCase.php @@ -110,7 +110,7 @@ public function testWordwrap($expected, $actual, $length, $break, $cut = false) $this->assertEquals($expected, $actual); } - public function wordwrapProvider() + public static function wordwrapProvider() { return [ [ diff --git a/Tests/FunctionsTest.php b/Tests/FunctionsTest.php index a721d85..6a69106 100644 --- a/Tests/FunctionsTest.php +++ b/Tests/FunctionsTest.php @@ -30,7 +30,7 @@ public function testS(AbstractString $expected, ?string $input) $this->assertEquals($expected, s($input)); } - public function provideSStrings(): array + public static function provideSStrings(): array { return [ [new UnicodeString(''), ''], @@ -50,7 +50,7 @@ public function testU(UnicodeString $expected, ?string $input) $this->assertEquals($expected, u($input)); } - public function provideUStrings(): array + public static function provideUStrings(): array { return [ [new UnicodeString(''), ''], @@ -68,7 +68,7 @@ public function testB(ByteString $expected, ?string $input) $this->assertEquals($expected, b($input)); } - public function provideBStrings(): array + public static function provideBStrings(): array { return [ [new ByteString(''), ''], diff --git a/Tests/Inflector/EnglishInflectorTest.php b/Tests/Inflector/EnglishInflectorTest.php index face92d..afe3b63 100644 --- a/Tests/Inflector/EnglishInflectorTest.php +++ b/Tests/Inflector/EnglishInflectorTest.php @@ -16,7 +16,7 @@ class EnglishInflectorTest extends TestCase { - public function singularizeProvider() + public static 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 @@ -166,7 +166,7 @@ public function singularizeProvider() ]; } - public function pluralizeProvider() + public static 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 diff --git a/Tests/Inflector/FrenchInflectorTest.php b/Tests/Inflector/FrenchInflectorTest.php index 1d5bdac..530b027 100644 --- a/Tests/Inflector/FrenchInflectorTest.php +++ b/Tests/Inflector/FrenchInflectorTest.php @@ -16,7 +16,7 @@ class FrenchInflectorTest extends TestCase { - public function pluralizeProvider() + public static function pluralizeProvider() { return [ // Le pluriel par défaut diff --git a/Tests/Slugger/AsciiSluggerTest.php b/Tests/Slugger/AsciiSluggerTest.php index d58c002..89b5887 100644 --- a/Tests/Slugger/AsciiSluggerTest.php +++ b/Tests/Slugger/AsciiSluggerTest.php @@ -16,7 +16,7 @@ class AsciiSluggerTest extends TestCase { - public function provideSlugTests(): iterable + public static function provideSlugTests(): iterable { yield ['', '']; yield ['foo', ' foo ']; From d7459121033df7951b0a24b4850f2e5ffa0c0ac2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 14 Feb 2023 09:53:37 +0100 Subject: [PATCH 4/7] Fix merge --- Tests/Slugger/AsciiSluggerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Slugger/AsciiSluggerTest.php b/Tests/Slugger/AsciiSluggerTest.php index 163be0e..3544367 100644 --- a/Tests/Slugger/AsciiSluggerTest.php +++ b/Tests/Slugger/AsciiSluggerTest.php @@ -26,7 +26,7 @@ public function testSlug(string $expected, string $string, string $separator = ' $this->assertSame($expected, (string) $slugger->slug($string, $separator, $locale)); } - public function provideSlugTests(): iterable + public static function provideSlugTests(): iterable { yield ['', '']; yield ['foo', ' foo ']; @@ -60,7 +60,7 @@ public function testSlugEmoji(string $expected, string $string, ?string $locale, $this->assertSame($expected, (string) $slugger->slug($string, '-', $locale)); } - public function provideSlugEmojiTests(): iterable + public static function provideSlugEmojiTests(): iterable { yield [ 'un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national', From 5eada2d416118a9c0ea149ff43c797be3f6521cc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 16 Feb 2023 10:33:00 +0100 Subject: [PATCH 5/7] CS fix --- Tests/SluggerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/SluggerTest.php b/Tests/SluggerTest.php index 4066867..6b4fc64 100644 --- a/Tests/SluggerTest.php +++ b/Tests/SluggerTest.php @@ -18,6 +18,7 @@ class SluggerTest extends TestCase { /** * @requires extension intl + * * @dataProvider provideSlug */ public function testSlug(string $string, string $locale, string $expectedSlug) From edac10d167b78b1d90f46a80320d632de0bd9f2f Mon Sep 17 00:00:00 2001 From: Albert Bakker Date: Wed, 22 Feb 2023 09:00:55 +0100 Subject: [PATCH 6/7] [String] Use same alphabet for ByteString::fromRandom tests --- Tests/ByteStringTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ByteStringTest.php b/Tests/ByteStringTest.php index 22842fb..f8415d5 100644 --- a/Tests/ByteStringTest.php +++ b/Tests/ByteStringTest.php @@ -28,7 +28,7 @@ public function testFromRandom() self::assertSame(32, $random->length()); foreach ($random->chunk() as $char) { - self::assertNotNull((new ByteString('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'))->indexOf($char)); + self::assertNotNull((new ByteString('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'))->indexOf($char)); } } From 8036a4c76c0dd29e60b6a7cafcacc50cf088ea62 Mon Sep 17 00:00:00 2001 From: Gwendolen Lynch Date: Tue, 14 Mar 2023 07:11:53 +0100 Subject: [PATCH 7/7] [String] Correct inflection of 'codes' and 'names' --- Inflector/EnglishInflector.php | 6 ++++++ Tests/Inflector/EnglishInflectorTest.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Inflector/EnglishInflector.php b/Inflector/EnglishInflector.php index 9f2fac6..edd94db 100644 --- a/Inflector/EnglishInflector.php +++ b/Inflector/EnglishInflector.php @@ -55,6 +55,9 @@ final class EnglishInflector implements InflectorInterface // indices (index), appendices (appendix), prices (price) ['seci', 4, false, true, ['ex', 'ix', 'ice']], + // codes (code) + ['sedoc', 5, false, true, 'code'], + // selfies (selfie) ['seifles', 7, true, true, 'selfie'], @@ -64,6 +67,9 @@ final class EnglishInflector implements InflectorInterface // movies (movie) ['seivom', 6, true, true, 'movie'], + // names (name) + ['seman', 5, true, false, 'name'], + // conspectuses (conspectus), prospectuses (prospectus) ['sesutcep', 8, true, true, 'pectus'], diff --git a/Tests/Inflector/EnglishInflectorTest.php b/Tests/Inflector/EnglishInflectorTest.php index afe3b63..f3b50fc 100644 --- a/Tests/Inflector/EnglishInflectorTest.php +++ b/Tests/Inflector/EnglishInflectorTest.php @@ -54,6 +54,7 @@ public static function singularizeProvider() ['children', 'child'], ['circuses', ['circus', 'circuse', 'circusis']], ['cliffs', 'cliff'], + ['codes', 'code'], ['committee', 'committee'], ['crises', ['cris', 'crise', 'crisis']], ['criteria', ['criterion', 'criterium']], @@ -108,6 +109,7 @@ public static function singularizeProvider() ['mice', 'mouse'], ['moves', 'move'], ['movies', 'movie'], + ['names', 'name'], ['nebulae', 'nebula'], ['neuroses', ['neuros', 'neurose', 'neurosis']], ['news', 'news'],