Skip to content

Commit e3c58b7

Browse files
committed
Support plural of matrix #10056
1 parent cf70e7d commit e3c58b7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Api/Plural.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ public static function make(string $name): string
2323
}
2424

2525
$plural = $name . 's';
26-
$plural = preg_replace('/ys$/', 'ies', $plural);
27-
if ($plural === null) {
28-
throw new Exception('Error while making plural');
29-
}
3026

31-
$plural = preg_replace('/ss$/', 'ses', $plural);
27+
$replacements = [
28+
'/ys$/' => 'ies',
29+
'/ss$/' => 'ses',
30+
'/xs$/' => 'xes',
31+
];
32+
33+
$plural = preg_replace(array_keys($replacements), $replacements, $plural);
3234
if ($plural === null) {
3335
throw new Exception('Error while making plural');
3436
}

tests/Api/PluralTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function providerMake(): iterable
127127
yield ['RiskClassification', 'RiskClassifications'];
128128
yield ['RiskFrequency', 'RiskFrequencies'];
129129
yield ['RiskLevel', 'RiskLevels'];
130-
yield ['RiskMatrix', 'RiskMatrixs'];
130+
yield ['RiskMatrix', 'RiskMatrixes'];
131131
yield ['RiskSeverity', 'RiskSeverities'];
132132
yield ['Rite', 'Rites'];
133133
yield ['RoleContextInterface', 'RoleContextInterfaces'];

0 commit comments

Comments
 (0)