ReplacerAwareExtensionTrait::withReplacer()   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\Extension\Awareness;
6
7
use DummyGenerator\Definitions\Extension\ExtensionInterface;
8
use DummyGenerator\Definitions\Replacer\ReplacerInterface;
9
10
/**
11
 * A helper trait to be used with ReplacerAwareExtension.
12
 */
13
trait ReplacerAwareExtensionTrait
14
{
15
    protected ReplacerInterface $replacer;
16
17 55
    public function withReplacer(ReplacerInterface $replacer): ExtensionInterface
18
    {
19 55
        $instance = clone $this;
20
21 55
        $instance->replacer = $replacer;
22
23 55
        return $instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $instance returns the type DummyGenerator\Definitio...acerAwareExtensionTrait which is incompatible with the type-hinted return DummyGenerator\Definitio...sion\ExtensionInterface.
Loading history...
24
    }
25
}
26