1 | <?php |
||
13 | class ValidationException extends \InvalidArgumentException |
||
14 | { |
||
15 | /** |
||
16 | * @var object |
||
17 | */ |
||
18 | protected $entity; |
||
19 | |||
20 | /** |
||
21 | * @var FormErrorIterator|ConstraintViolationListInterface |
||
22 | */ |
||
23 | protected $report; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $groups; |
||
29 | |||
30 | /** |
||
31 | * construct. |
||
32 | * |
||
33 | * @param object $entity |
||
34 | * @param FormErrorIterator|ConstraintViolationListInterface $report |
||
35 | * @param array $groups |
||
36 | * @param int $code |
||
37 | * @param \Exception $previous |
||
38 | */ |
||
39 | public function __construct( |
||
70 | |||
71 | /** |
||
72 | * return failed entity |
||
73 | * |
||
74 | * @return object |
||
75 | */ |
||
76 | public function getEntity() |
||
80 | |||
81 | /** |
||
82 | * return validation groups which are failing |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getGroups() |
||
90 | |||
91 | /** |
||
92 | * return violation list report |
||
93 | * |
||
94 | * @return EntityCollection|FormErrorIterator|ConstraintViolationListInterface |
||
95 | */ |
||
96 | public function getReport() |
||
103 | |||
104 | /** |
||
105 | * format and return report (translatable) messages |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | public function formatReport() |
||
135 | } |
||
136 |
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.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.