updated composer

This commit is contained in:
2021-05-18 13:47:03 +00:00
parent e248cd036c
commit ba92152daa
1187 changed files with 20804 additions and 22320 deletions

View File

@@ -18,7 +18,7 @@ final class EnglishInflector implements InflectorInterface
*
* @see http://english-zone.com/spelling/plurals.html
*/
private static $pluralMap = [
private const PLURAL_MAP = [
// First entry: plural suffix, reversed
// Second entry: length of plural suffix
// Third entry: Whether the suffix may succeed a vocal
@@ -61,6 +61,9 @@ final class EnglishInflector implements InflectorInterface
// movies (movie)
['seivom', 6, true, true, 'movie'],
// conspectuses (conspectus), prospectuses (prospectus)
['sesutcep', 8, true, true, 'pectus'],
// feet (foot)
['teef', 4, true, true, 'foot'],
@@ -118,6 +121,9 @@ final class EnglishInflector implements InflectorInterface
// fees (fee), trees (tree), employees (employee)
['see', 3, true, true, 'ee'],
// edges (edge)
['segd', 4, true, true, 'dge'],
// roses (rose), garages (garage), cassettes (cassette),
// waltzes (waltz), heroes (hero), bushes (bush), arches (arch),
// shoes (shoe)
@@ -138,7 +144,7 @@ final class EnglishInflector implements InflectorInterface
*
* @see http://english-zone.com/spelling/plurals.html
*/
private static $singularMap = [
private const SINGULAR_MAP = [
// First entry: singular suffix, reversed
// Second entry: length of singular suffix
// Third entry: Whether the suffix may succeed a vocal
@@ -226,6 +232,9 @@ final class EnglishInflector implements InflectorInterface
// bacteria (bacterium), criteria (criterion), phenomena (phenomenon)
['noi', 3, true, true, 'ions'],
// coupon (coupons)
['nop', 3, true, true, 'pons'],
// seasons (season), treasons (treason), poisons (poison), lessons (lesson)
['nos', 3, true, true, 'sons'],
@@ -261,6 +270,9 @@ final class EnglishInflector implements InflectorInterface
// circuses (circus)
['suc', 3, true, true, 'cuses'],
// conspectuses (conspectus), prospectuses (prospectus)
['sutcep', 6, true, true, 'pectuses'],
// fungi (fungus), alumni (alumnus), syllabi (syllabus), radii (radius)
['su', 2, true, true, 'i'],
@@ -304,16 +316,34 @@ final class EnglishInflector implements InflectorInterface
/**
* A list of words which should not be inflected, reversed.
*/
private static $uninflected = [
private const UNINFLECTED = [
'',
// data
'atad',
// deer
'reed',
// feedback
'kcabdeef',
// fish
'hsif',
// info
'ofni',
// moose
'esoom',
// series
'seires',
// sheep
'peehs',
// species
'seiceps',
];
@@ -327,7 +357,7 @@ final class EnglishInflector implements InflectorInterface
$pluralLength = \strlen($lowerPluralRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerPluralRev, self::$uninflected, true)) {
if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
return [$plural];
}
@@ -335,7 +365,7 @@ final class EnglishInflector implements InflectorInterface
// The inner loop $j iterates over the characters of the plural suffix
// in the plural table to compare them with the characters of the actual
// given plural suffix
foreach (self::$pluralMap as $map) {
foreach (self::PLURAL_MAP as $map) {
$suffix = $map[0];
$suffixLength = $map[1];
$j = 0;
@@ -406,7 +436,7 @@ final class EnglishInflector implements InflectorInterface
$singularLength = \strlen($lowerSingularRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerSingularRev, self::$uninflected, true)) {
if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
return [$singular];
}
@@ -414,7 +444,7 @@ final class EnglishInflector implements InflectorInterface
// The inner loop $j iterates over the characters of the singular suffix
// in the singular table to compare them with the characters of the actual
// given singular suffix
foreach (self::$singularMap as $map) {
foreach (self::SINGULAR_MAP as $map) {
$suffix = $map[0];
$suffixLength = $map[1];
$j = 0;

View File

@@ -23,7 +23,7 @@ final class FrenchInflector implements InflectorInterface
*
* @see https://la-conjugaison.nouvelobs.com/regles/grammaire/le-pluriel-des-noms-121.php
*/
private static $pluralizeRegexp = [
private const PLURALIZE_REGEXP = [
// First entry: regexp
// Second entry: replacement
@@ -67,7 +67,7 @@ final class FrenchInflector implements InflectorInterface
/**
* A list of all rules for singularize.
*/
private static $singularizeRegexp = [
private const SINGULARIZE_REGEXP = [
// First entry: regexp
// Second entry: replacement
@@ -108,7 +108,7 @@ final class FrenchInflector implements InflectorInterface
* A list of words which should not be inflected.
* This list is only used by singularize.
*/
private static $uninflected = '/^(abcès|accès|abus|albatros|anchois|anglais|autobus|bois|brebis|carquois|cas|chas|colis|concours|corps|cours|cyprès|décès|devis|discours|dos|embarras|engrais|entrelacs|excès|fils|fois|gâchis|gars|glas|héros|intrus|jars|jus|kermès|lacis|legs|lilas|marais|mars|matelas|mépris|mets|mois|mors|obus|os|palais|paradis|parcours|pardessus|pays|plusieurs|poids|pois|pouls|printemps|processus|progrès|puits|pus|rabais|radis|recors|recours|refus|relais|remords|remous|rictus|rhinocéros|repas|rubis|sas|secours|sens|souris|succès|talus|tapis|tas|taudis|temps|tiers|univers|velours|verglas|vernis|virus)$/i';
private const UNINFLECTED = '/^(abcès|accès|abus|albatros|anchois|anglais|autobus|bois|brebis|carquois|cas|chas|colis|concours|corps|cours|cyprès|décès|devis|discours|dos|embarras|engrais|entrelacs|excès|fils|fois|gâchis|gars|glas|héros|intrus|jars|jus|kermès|lacis|legs|lilas|marais|mars|matelas|mépris|mets|mois|mors|obus|os|palais|paradis|parcours|pardessus|pays|plusieurs|poids|pois|pouls|printemps|processus|progrès|puits|pus|rabais|radis|recors|recours|refus|relais|remords|remous|rictus|rhinocéros|repas|rubis|sas|secours|sens|souris|succès|talus|tapis|tas|taudis|temps|tiers|univers|velours|verglas|vernis|virus)$/i';
/**
* {@inheritdoc}
@@ -119,7 +119,7 @@ final class FrenchInflector implements InflectorInterface
return [$plural];
}
foreach (self::$singularizeRegexp as $rule) {
foreach (self::SINGULARIZE_REGEXP as $rule) {
[$regexp, $replace] = $rule;
if (1 === preg_match($regexp, $plural)) {
@@ -139,7 +139,7 @@ final class FrenchInflector implements InflectorInterface
return [$singular];
}
foreach (self::$pluralizeRegexp as $rule) {
foreach (self::PLURALIZE_REGEXP as $rule) {
[$regexp, $replace] = $rule;
if (1 === preg_match($regexp, $singular)) {
@@ -152,6 +152,6 @@ final class FrenchInflector implements InflectorInterface
private function isInflectedWord(string $word): bool
{
return 1 === preg_match(self::$uninflected, $word);
return 1 === preg_match(self::UNINFLECTED, $word);
}
}

View File

@@ -1,4 +1,4 @@
Copyright (c) 2019-2020 Fabien Potencier
Copyright (c) 2019-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

View File

@@ -11,22 +11,28 @@
namespace Symfony\Component\String;
function u(?string $string = ''): UnicodeString
{
return new UnicodeString($string ?? '');
if (!\function_exists(u::class)) {
function u(?string $string = ''): UnicodeString
{
return new UnicodeString($string ?? '');
}
}
function b(?string $string = ''): ByteString
{
return new ByteString($string ?? '');
if (!\function_exists(b::class)) {
function b(?string $string = ''): ByteString
{
return new ByteString($string ?? '');
}
}
/**
* @return UnicodeString|ByteString
*/
function s(?string $string = ''): AbstractString
{
$string = $string ?? '';
if (!\function_exists(s::class)) {
/**
* @return UnicodeString|ByteString
*/
function s(?string $string = ''): AbstractString
{
$string = $string ?? '';
return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
}
}

View File

@@ -359,6 +359,10 @@ class UnicodeString extends AbstractUnicodeString
public function __wakeup()
{
if (!\is_string($this->string)) {
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
}

View File

@@ -1,7 +1,7 @@
{
"name": "symfony/string",
"type": "library",
"description": "Symfony String component",
"description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
"keywords": ["string", "utf8", "utf-8", "grapheme", "i18n", "unicode"],
"homepage": "https://symfony.com",
"license": "MIT",