Skip to content

Commit 3d4f1b3

Browse files
authored
Fix phpstan (#522)
* Fix phpstan * fix * fix
1 parent 87a1038 commit 3d4f1b3

3 files changed

Lines changed: 33 additions & 15 deletions

File tree

inc/notificationtargetorder.class.php

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function addDataForTemplate($event, $options = [])
9898
$this->data[$tag] = $values['label'];
9999
}
100100
}
101-
} else {
101+
} elseif ($this->obj instanceof CommonDBTM) {
102102
$this->data['##lang.ordervalidation.title##'] = $events[$event];
103103

104104
$this->data['##lang.ordervalidation.entity##'] = __s("Entity");
@@ -503,22 +503,40 @@ public function addSpecificTargets($data, $options)
503503
$this->addUserByField("users_id_delivery");
504504
break;
505505
case self::AUTHOR_GROUP:
506-
$this->addForGroup(0, $this->obj->fields['groups_id']);
506+
if ($this->obj instanceof CommonDBTM) {
507+
$this->addForGroup(0, $this->obj->fields['groups_id']);
508+
}
509+
507510
break;
508511
case self::DELIVERY_GROUP:
509-
$this->addForGroup(0, $this->obj->fields['groups_id_delivery']);
512+
if ($this->obj instanceof CommonDBTM) {
513+
$this->addForGroup(0, $this->obj->fields['groups_id_delivery']);
514+
}
515+
510516
break;
511517
case self::SUPERVISOR_AUTHOR_GROUP:
512-
$this->addForGroup(1, $this->obj->fields['groups_id']);
518+
if ($this->obj instanceof CommonDBTM) {
519+
$this->addForGroup(1, $this->obj->fields['groups_id']);
520+
}
521+
513522
break;
514523
case self::SUPERVISOR_DELIVERY_GROUP:
515-
$this->addForGroup(1, $this->obj->fields['groups_id_delivery']);
524+
if ($this->obj instanceof CommonDBTM) {
525+
$this->addForGroup(1, $this->obj->fields['groups_id_delivery']);
526+
}
527+
516528
break;
517529
case self::SUPPLIER:
518-
$this->addAddressesByType("suppliers", $this->obj->fields['id']);
530+
if ($this->obj instanceof CommonDBTM) {
531+
$this->addAddressesByType("suppliers", $this->obj->fields['id']);
532+
}
533+
519534
break;
520535
case self::CONTACT:
521-
$this->addAddressesByType("contacts", $this->obj->fields['id']);
536+
if ($this->obj instanceof CommonDBTM) {
537+
$this->addAddressesByType("contacts", $this->obj->fields['id']);
538+
}
539+
522540
break;
523541
}
524542
}

inc/order.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,12 @@ public function post_updateItem($history = true)
780780
$infocom = new Infocom();
781781
$query = [
782782
'SELECT' => [
783-
`items_id`,
784-
`itemtype`,
783+
'items_id',
784+
'itemtype',
785785
],
786-
'FROM' => `glpi_plugin_order_orders_items`,
786+
'FROM' => 'glpi_plugin_order_orders_items',
787787
'WHERE' => [
788-
`plugin_order_orders_id` => $this->getID(),
788+
'plugin_order_orders_id' => $this->getID(),
789789
],
790790
];
791791
foreach ($DB->request($query) as $infos) {

inc/order_supplier.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ public static function install(Migration $migration)
437437
//1.5.0
438438
$query = [
439439
'SELECT' => [
440-
`suppliers_id`,
441-
`entities_id`,
442-
`is_recursive`,
443-
`id`,
440+
'suppliers_id',
441+
'entities_id',
442+
'is_recursive',
443+
'id',
444444
],
445445
'FROM' => 'glpi_plugin_order_orders',
446446
];

0 commit comments

Comments
 (0)