RandomizerAwareReplacerTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 5
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A withRandomizer() 0 7 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace DummyGenerator\Definitions\Replacer;
6
7
use DummyGenerator\Definitions\Randomizer\RandomizerInterface;
8
9
/**
10
 * A helper trait to be used with RandomizerAwareReplacer.
11
 */
12
trait RandomizerAwareReplacerTrait
13
{
14
    protected RandomizerInterface $randomizer;
15
16 67
    public function withRandomizer(RandomizerInterface $randomizer): ReplacerInterface
17
    {
18 67
        $instance = clone $this;
19
20 67
        $instance->randomizer = $randomizer;
21
22 67
        return $instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $instance returns the type DummyGenerator\Definitio...mizerAwareReplacerTrait which is incompatible with the type-hinted return DummyGenerator\Definitio...lacer\ReplacerInterface.
Loading history...
23
    }
24
}
25