| 1 | <?php |
||
| 7 | class OpeningHours |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var OpeningHour[] |
||
| 11 | */ |
||
| 12 | private $openingHours; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * OpeningHours constructor. |
||
| 16 | * @param OpeningHour[]|null $openingHours |
||
| 17 | */ |
||
| 18 | public function __construct(array $openingHours = null) |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param OpeningHour $openingHour |
||
| 25 | */ |
||
| 26 | public function addOpeningHour(OpeningHour $openingHour) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return OpeningHour[] |
||
| 33 | */ |
||
| 34 | public function getOpeningHours() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return Weekday[] |
||
| 41 | */ |
||
| 42 | public function getWeekDays() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param OpeningHour $otherOpeningHour |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | public function equalOpeningHour(OpeningHour $otherOpeningHour) |
||
| 70 | } |
||
| 71 |
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
$needlebut will only accept an array as$haystack.