Passed
Push — master ( 134841...7712b0 )
by Mr
02:17
created

AnnotatedEvent::withAggregateRevision()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
ccs 4
cts 4
cp 1
crap 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/event-sourcing project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\EventSourcing\Aggregate\Event;
10
11
use Daikon\EventSourcing\Aggregate\AggregateAnnotated;
12
use Daikon\EventSourcing\Aggregate\AggregateRevision;
13
use Daikon\Interop\FromToNativeTrait;
14
15
trait AnnotatedEvent
16
{
17
    use AggregateAnnotated;
18
    use FromToNativeTrait;
19
20 2
    public function getAggregateRevision(): AggregateRevision
21
    {
22 2
        return $this->{static::getAnnotatedRevision()};
23
    }
24
25
    /** @return static */
26 1
    public function withAggregateRevision(AggregateRevision $aggregateRevision): self
27
    {
28
        /** @var DomainEventInterface $copy */
29 1
        $copy = clone $this;
30 1
        $copy->{static::getAnnotatedRevision()} = $aggregateRevision;
31 1
        return $copy;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $copy returns the type Daikon\EventSourcing\Agg...nt\DomainEventInterface which is incompatible with the type-hinted return Daikon\EventSourcing\Agg...te\Event\AnnotatedEvent.
Loading history...
32
    }
33
}
34