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

AnnotatedEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 17
rs 10
ccs 6
cts 6
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withAggregateRevision() 0 6 1
A getAggregateRevision() 0 3 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