@@ -21,7 +21,7 @@ final class EnglishInflector implements InflectorInterface
21
21
private const PLURAL_MAP = [
22
22
// First entry: plural suffix, reversed
23
23
// Second entry: length of plural suffix
24
- // Third entry: Whether the suffix may succeed a vocal
24
+ // Third entry: Whether the suffix may succeed a vowel
25
25
// Fourth entry: Whether the suffix may succeed a consonant
26
26
// Fifth entry: singular suffix, normal
27
27
@@ -162,7 +162,7 @@ final class EnglishInflector implements InflectorInterface
162
162
private const SINGULAR_MAP = [
163
163
// First entry: singular suffix, reversed
164
164
// Second entry: length of singular suffix
165
- // Third entry: Whether the suffix may succeed a vocal
165
+ // Third entry: Whether the suffix may succeed a vowel
166
166
// Fourth entry: Whether the suffix may succeed a consonant
167
167
// Fifth entry: plural suffix, normal
168
168
@@ -343,15 +343,30 @@ final class EnglishInflector implements InflectorInterface
343
343
// deer
344
344
'reed ' ,
345
345
346
+ // equipment
347
+ 'tnempiuqe ' ,
348
+
346
349
// feedback
347
350
'kcabdeef ' ,
348
351
349
352
// fish
350
353
'hsif ' ,
351
354
355
+ // health
356
+ 'htlaeh ' ,
357
+
358
+ // history
359
+ 'yrotsih ' ,
360
+
352
361
// info
353
362
'ofni ' ,
354
363
364
+ // information
365
+ 'noitamrofni ' ,
366
+
367
+ // money
368
+ 'yenom ' ,
369
+
355
370
// moose
356
371
'esoom ' ,
357
372
@@ -363,6 +378,9 @@ final class EnglishInflector implements InflectorInterface
363
378
364
379
// species
365
380
'seiceps ' ,
381
+
382
+ // traffic
383
+ 'ciffart ' ,
366
384
];
367
385
368
386
/**
@@ -399,14 +417,14 @@ public function singularize(string $plural): array
399
417
if ($ j === $ suffixLength ) {
400
418
// Is there any character preceding the suffix in the plural string?
401
419
if ($ j < $ pluralLength ) {
402
- $ nextIsVocal = false !== strpos ('aeiou ' , $ lowerPluralRev [$ j ]);
420
+ $ nextIsVowel = false !== strpos ('aeiou ' , $ lowerPluralRev [$ j ]);
403
421
404
- if (!$ map [2 ] && $ nextIsVocal ) {
405
- // suffix may not succeed a vocal but next char is one
422
+ if (!$ map [2 ] && $ nextIsVowel ) {
423
+ // suffix may not succeed a vowel but next char is one
406
424
break ;
407
425
}
408
426
409
- if (!$ map [3 ] && !$ nextIsVocal ) {
427
+ if (!$ map [3 ] && !$ nextIsVowel ) {
410
428
// suffix may not succeed a consonant but next char is one
411
429
break ;
412
430
}
@@ -479,14 +497,14 @@ public function pluralize(string $singular): array
479
497
if ($ j === $ suffixLength ) {
480
498
// Is there any character preceding the suffix in the plural string?
481
499
if ($ j < $ singularLength ) {
482
- $ nextIsVocal = false !== strpos ('aeiou ' , $ lowerSingularRev [$ j ]);
500
+ $ nextIsVowel = false !== strpos ('aeiou ' , $ lowerSingularRev [$ j ]);
483
501
484
- if (!$ map [2 ] && $ nextIsVocal ) {
485
- // suffix may not succeed a vocal but next char is one
502
+ if (!$ map [2 ] && $ nextIsVowel ) {
503
+ // suffix may not succeed a vowel but next char is one
486
504
break ;
487
505
}
488
506
489
- if (!$ map [3 ] && !$ nextIsVocal ) {
507
+ if (!$ map [3 ] && !$ nextIsVowel ) {
490
508
// suffix may not succeed a consonant but next char is one
491
509
break ;
492
510
}
0 commit comments