Completed
Push — master ( 332a47...cbc99e )
by WEBEWEB
03:08
created

AbstractBootstrapEvent::setEventName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the bootstrap-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\BootstrapBundle\Event;
13
14
use Symfony\Component\EventDispatcher\Event;
15
16
/**
17
 * Abstract Bootstrap event.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\BootstrapBundle\Event
21
 * @abstract
22
 */
23
abstract class AbstractBootstrapEvent extends Event {
24
25
    /**
26
     * Event name.
27
     *
28
     * @var string
29
     */
30
    private $eventName;
31
32
    /**
33
     * Constructor.
34
     *
35
     * @param string $eventName The event name.
36
     */
37
    protected function __construct($eventName) {
38
        $this->setEventName($eventName);
0 ignored issues
show
Documentation introduced by
$eventName is of type string, but the function expects a object<WBW\Bundle\BootstrapBundle\Event\type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
39
    }
40
41
    /**
42
     * Get the event name.
43
     *
44
     * @return string Returns the event name.
45
     */
46
    public function getEventName() {
47
        return $this->eventName;
48
    }
49
50
    /**
51
     * Set the event name.
52
     *
53
     * @param type $eventName The event name.
54
     * @return AbstractBootstrapEvent Returns this Bootstrap event.
55
     */
56
    protected function setEventName($eventName) {
57
        $this->eventName = $eventName;
0 ignored issues
show
Documentation Bug introduced by
It seems like $eventName of type object<WBW\Bundle\BootstrapBundle\Event\type> is incompatible with the declared type string of property $eventName.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
58
        return $this;
59
    }
60
61
}
62