withTransliterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace DummyGenerator\Definitions\Transliterator;
6
7
use DummyGenerator\Definitions\Replacer\ReplacerInterface;
8
9
/**
10
 * A helper trait to be used with TransliteratorAwareReplacer.
11
 */
12
trait TransliteratorAwareReplacerTrait
13
{
14
    protected TransliteratorInterface $transliterator;
15
16 63
    public function withTransliterator(TransliteratorInterface $transliterator): ReplacerInterface
17
    {
18 63
        $instance = clone $this;
19
20 63
        $instance->transliterator = $transliterator;
21
22 63
        return $instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $instance returns the type DummyGenerator\Definitio...ratorAwareReplacerTrait which is incompatible with the type-hinted return DummyGenerator\Definitio...lacer\ReplacerInterface.
Loading history...
23
    }
24
}
25