Inflectible::getPlural()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 9
ccs 8
cts 8
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Inflector\Rules\French;
6
7
use Doctrine\Inflector\Rules\Pattern;
8
use Doctrine\Inflector\Rules\Substitution;
9
use Doctrine\Inflector\Rules\Transformation;
10
use Doctrine\Inflector\Rules\Word;
11
12
class Inflectible
13
{
14
    /**
15
     * @return Transformation[]
16
     */
17 73
    public static function getSingular() : iterable
18
    {
19 73
        yield new Transformation(new Pattern('/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/'), '\1ail');
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...|vitr)aux$/'), '\1ail') returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Transformation[].
Loading history...
20 73
        yield new Transformation(new Pattern('/ails$/'), 'ail');
21 73
        yield new Transformation(new Pattern('/(journ|chev)aux$/'), '\1al');
22 73
        yield new Transformation(new Pattern('/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/'), '\1');
23 73
        yield new Transformation(new Pattern('/s$/'), '');
24 73
    }
25
26
    /**
27
     * @return Transformation[]
28
     */
29 73
    public static function getPlural() : iterable
30
    {
31 73
        yield new Transformation(new Pattern('/(s|x|z)$/'), '\1');
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...rn('/(s|x|z)$/'), '\1') returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Transformation[].
Loading history...
32 73
        yield new Transformation(new Pattern('/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/'), '\1aux');
33 73
        yield new Transformation(new Pattern('/ail$/'), 'ails');
34 73
        yield new Transformation(new Pattern('/al$/'), 'aux');
35 73
        yield new Transformation(new Pattern('/(bleu|émeu|landau|lieu|pneu|sarrau)$/'), '\1s');
36 73
        yield new Transformation(new Pattern('/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/'), '\1x');
37 73
        yield new Transformation(new Pattern('/$/'), 's');
38 73
    }
39
40
    /**
41
     * @return Substitution[]
42
     */
43 73
    public static function getIrregular() : iterable
44
    {
45 73
        yield new Substitution(new Word('monsieur'), new Word('messieurs'));
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new Doctrine\Infle...ules\Word('messieurs')) returns the type Generator which is incompatible with the documented return type Doctrine\Inflector\Rules\Substitution[].
Loading history...
46 73
        yield new Substitution(new Word('madame'), new Word('mesdames'));
47 73
        yield new Substitution(new Word('mademoiselle'), new Word('mesdemoiselles'));
48 73
    }
49
}
50