This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
9
{
10
/**
11
* quando accade l'evento
12
*
13
* @var \DateTime
14
*/
15
private $occurredOn;
16
17
/**
18
* id dell'aggregato root relativo all'evento
19
*
20
* @var int
21
*/
22
private $aggregateId;
23
24
/**
25
* proprietà dell'evento
26
*
27
* @var array
28
*/
29
private $properties;
30
31
/**
32
* costruttore
33
*/
34
final public function __construct($aggregateId, array $properties = null)
It seems like $properties can be null. However, the property $properties is declared as array. Maybe change the type of the property to array|null or add a type check?
Our type inference engine has found an assignment of a scalar value (like a
string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added
to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set
a type hint of array and a default value of null. The PHP interpreter will
then accept both an array or null for that parameter.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.