File tree 2 files changed +23
-10
lines changed
2 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,12 @@ function depluralize(string $sWord) : string {
22
22
->withSingularRules (
23
23
new Ruleset (
24
24
new Transformations (),
25
- new Patterns (),
26
- new Substitutions (new Substitution (new Word ('data ' ), new Word ('datum ' )))
25
+ new Patterns (
26
+ new Pattern ('beta ' )
27
+ ),
28
+ new Substitutions (
29
+ new Substitution (new Word ('data ' ), new Word ('datum ' ))
30
+ )
27
31
)
28
32
)
29
33
->build ();
@@ -36,6 +40,16 @@ function depluralize(string $sWord) : string {
36
40
*/
37
41
function pluralize (string $ sWord ): string {
38
42
// https://www.doctrine-project.org/projects/doctrine-inflector/en/2.0/index.html
39
- $ oInflector = InflectorFactory::create ()->build ();
43
+ $ oInflector = InflectorFactory::create ()
44
+ ->withPluralRules (
45
+ new Ruleset (
46
+ new Transformations (),
47
+ new Patterns (
48
+ new Pattern ('geese ' )
49
+ ),
50
+ new Substitutions ()
51
+ )
52
+ )
53
+ ->build ();
40
54
return $ oInflector ->pluralize ($ sWord );
41
55
}
Original file line number Diff line number Diff line change @@ -26,18 +26,17 @@ public function setUp():void {
26
26
];
27
27
}
28
28
29
- public function testDepluralize (): void
30
- {
29
+ public function testDepluralize (): void {
31
30
foreach ($ this ->aWords as $ sPlural => $ sSingular ) {
32
- $ this ->assertEquals ($ sSingular , depluralize ($ sPlural ));
31
+ self ::assertEquals ($ sSingular , depluralize ($ sPlural ));
32
+ self ::assertEquals ($ sSingular , depluralize ($ sSingular ));
33
33
}
34
34
}
35
35
36
- public function testPluralize (): void
37
- {
36
+ public function testPluralize (): void {
38
37
foreach ($ this ->aWords as $ sPlural => $ sSingular ) {
39
- $ this ->assertEquals ($ sPlural , pluralize ($ sSingular ));
38
+ self ::assertEquals ($ sPlural , pluralize ($ sSingular ));
39
+ self ::assertEquals ($ sPlural , pluralize ($ sPlural ));
40
40
}
41
41
}
42
-
43
42
}
You can’t perform that action at this time.
0 commit comments