Completed
Push — master ( c6f552...0c6c94 )
by Dmitry
15:05
created

NamedEventTrait::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace hiapi\event;
4
5
/**
6
 * Trait NamedEventTrait
7
 *
8
 * @author Dmytro Naumenko <[email protected]>
9
 */
10
trait NamedEventTrait
11
{
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
    
17
    public static function create(string $name, $target = null): self
18
    {
19
        $event = new self($target);
0 ignored issues
show
Unused Code introduced by
The call to NamedEventTrait::__construct() has too many arguments starting with $target.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
20
        $event->name = $name;
21
        
22
        return $event;
23
    }
24
    
25
    /**
26
     * @inheritdoc
27
     */
28
    public function getName()
29
    {
30
        return $this->name;
31
    }
32
}
33