1 | <?php |
||
7 | class NounPluralization extends \morphos\BasePluralization |
||
8 | { |
||
9 | /** |
||
10 | * @var string[] |
||
11 | * @phpstan-var array<string, string> |
||
12 | */ |
||
13 | private static $exceptions = [ |
||
14 | 'chief' => 'chiefs', |
||
15 | 'basis' => 'bases', |
||
16 | 'crisis' => 'crises', |
||
17 | 'radius' => 'radii', |
||
18 | 'nucleus' => 'nuclei', |
||
19 | 'curriculum' => 'curricula', |
||
20 | 'man' => 'men', |
||
21 | 'woman' => 'women', |
||
22 | 'child' => 'children', |
||
23 | 'foot' => 'feet', |
||
24 | 'tooth' => 'teeth', |
||
25 | 'ox' => 'oxen', |
||
26 | 'goose' => 'geese', |
||
27 | 'mouse' => 'mice' |
||
28 | ]; |
||
29 | |||
30 | /** @var string[] */ |
||
31 | private static $without_paired_form = [ |
||
32 | 'knowledge', |
||
33 | 'progress', |
||
34 | 'advise', |
||
35 | 'ink', |
||
36 | 'money', |
||
37 | 'scissors', |
||
38 | 'spectacles', |
||
39 | 'trousers', |
||
40 | ]; |
||
41 | |||
42 | /** @var string[] */ |
||
43 | public static $consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'x', 'z', 'w']; |
||
44 | |||
45 | /** |
||
46 | * @param string $word |
||
47 | * @param int $count |
||
48 | * @return string |
||
49 | */ |
||
50 | 50 | public static function pluralize($word, $count = 2) |
|
79 | |||
80 | public static function getCase($word, $case, $animateness = false) |
||
84 | |||
85 | public static function getCases($word, $animateness = false) |
||
89 | } |
||
90 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: