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);
}
}