| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 18 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | View Code Duplication | public function __construct(Table $table, array $data = []) |
|
| 19 | { |
||
| 20 | $this->table = $table; |
||
| 21 | |||
| 22 | $this->query = $table->getDatabase() |
||
| 23 | ->insert() |
||
| 24 | ->into((string) $table); |
||
| 25 | |||
| 26 | foreach ($data as $fieldName => $value) { |
||
| 27 | $this->table->{$fieldName}->insert($this->query, $value); |
||
| 28 | } |
||
| 29 | |||
| 30 | $eventDispatcher = $table->getEventDispatcher(); |
||
| 31 | |||
| 32 | if ($eventDispatcher) { |
||
| 33 | $eventDispatcher->dispatch(new CreateInsertQuery($this)); |
||
|
|
|||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 46 |
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: