| 1 | <?php |
||
| 7 | class TableRelation |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | public $name; |
||
| 13 | /** |
||
| 14 | * @var Table |
||
| 15 | */ |
||
| 16 | public $table; |
||
| 17 | /** |
||
| 18 | * @var string[] |
||
| 19 | */ |
||
| 20 | public $keymap; |
||
| 21 | /** |
||
| 22 | * @var bool |
||
| 23 | */ |
||
| 24 | public $many; |
||
| 25 | /** |
||
| 26 | * @var Table|null |
||
| 27 | */ |
||
| 28 | public $pivot; |
||
| 29 | /** |
||
| 30 | * @var string[] |
||
| 31 | */ |
||
| 32 | public $pivot_keymap; |
||
| 33 | /** |
||
| 34 | * @var string|null |
||
| 35 | */ |
||
| 36 | public $sql; |
||
| 37 | /** |
||
| 38 | * @var array|null |
||
| 39 | */ |
||
| 40 | public $par; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Create a new instance |
||
| 44 | * @param string $name the name of the relation |
||
| 45 | * @param Table $table the foreign table definition |
||
| 46 | * @param array $keymap the keymap (local => foreign) |
||
| 47 | * @param bool $many is it a one to many rows relation, defaults to false |
||
| 48 | * @param Table|null $pivot the pivot table definition (if exists), defaults to null |
||
| 49 | * @param array|null $keymap the keymap (local => foreign), defaults to null |
||
| 50 | * @param string|null $sql additional where clauses to use, default to null |
||
| 51 | * @param array $par parameters for the above statement, defaults to null |
||
| 52 | */ |
||
| 53 | public function __construct( |
||
| 72 | } |
||
| 73 |
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.