Skip to content

Commit 5d9a809

Browse files
authored
Add missing types in device classes (#21847)
1 parent 4e9a00a commit 5d9a809

14 files changed

+127
-52
lines changed

src/CommonDBRelation.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,25 @@ abstract class CommonDBRelation extends CommonDBConnexity
5050
public static $itemtype_1; // Type ref or field name (must start with itemtype)
5151
/** @var ?string $items_id_1 */
5252
public static $items_id_1; // Field name
53-
// * entity inheritance
54-
/** @var bool */
53+
/** @var bool If entity must be taken from item 1 */
5554
public static $take_entity_1 = true;
5655
// * rights
5756
/** @var CommonDBConnexity::DONT_CHECK_ITEM_RIGHTS|CommonDBConnexity::HAVE_VIEW_RIGHT_ON_ITEM|CommonDBConnexity::HAVE_SAME_RIGHT_ON_ITEM */
5857
public static $checkItem_1_Rights = self::HAVE_SAME_RIGHT_ON_ITEM;
59-
/** @var bool */
58+
/** @var bool If item 1 must be attached to the relation */
6059
public static $mustBeAttached_1 = true;
6160
// * log
62-
/** @var bool */
61+
/** @var bool If historical logs must be done for item 1 */
6362
public static $logs_for_item_1 = true;
64-
/** @var Log::HISTORY_* */
63+
/** @var Log::HISTORY_* The historical log entry action type to use for add actions */
6564
public static $log_history_1_add = Log::HISTORY_ADD_RELATION;
66-
/** @var Log::HISTORY_* */
65+
/** @var Log::HISTORY_* The historical log entry action type to use for update actions */
6766
public static $log_history_1_update = Log::HISTORY_UPDATE_RELATION;
68-
/** @var Log::HISTORY_* */
67+
/** @var Log::HISTORY_* The historical log entry action type to use for delete actions */
6968
public static $log_history_1_delete = Log::HISTORY_DEL_RELATION;
70-
/** @var Log::HISTORY_* */
69+
/** @var Log::HISTORY_* The historical log entry action type to use for lock actions */
7170
public static $log_history_1_lock = Log::HISTORY_LOCK_RELATION;
72-
/** @var Log::HISTORY_* */
71+
/** @var Log::HISTORY_* The historical log entry action type to use for unlock actions */
7372
public static $log_history_1_unlock = Log::HISTORY_UNLOCK_RELATION;
7473

7574
// Item 2 information
@@ -78,26 +77,25 @@ abstract class CommonDBRelation extends CommonDBConnexity
7877
public static $itemtype_2; // Type ref or field name (must start with itemtype)
7978
/** @var ?string $items_id_2 */
8079
public static $items_id_2; // Field name
81-
// * entity inheritance
82-
/** @var bool */
80+
/** @var bool If entity must be taken from item 2 */
8381
public static $take_entity_2 = false;
8482
// * rights
8583
/** @var CommonDBConnexity::DONT_CHECK_ITEM_RIGHTS|CommonDBConnexity::HAVE_VIEW_RIGHT_ON_ITEM|CommonDBConnexity::HAVE_SAME_RIGHT_ON_ITEM */
8684
public static $checkItem_2_Rights = self::HAVE_SAME_RIGHT_ON_ITEM;
87-
/** @var bool */
85+
/** @var bool If item 2 must be attached to the relation */
8886
public static $mustBeAttached_2 = true;
8987
// * log
90-
/** @var bool */
88+
/** @var bool If historical logs must be done for item 2 */
9189
public static $logs_for_item_2 = true;
92-
/** @var Log::HISTORY_* */
90+
/** @var Log::HISTORY_* The historical log entry action type to use for add actions */
9391
public static $log_history_2_add = Log::HISTORY_ADD_RELATION;
94-
/** @var Log::HISTORY_* */
92+
/** @var Log::HISTORY_* The historical log entry action type to use for update actions */
9593
public static $log_history_2_update = Log::HISTORY_UPDATE_RELATION;
96-
/** @var Log::HISTORY_* */
94+
/** @var Log::HISTORY_* The historical log entry action type to use for delete actions */
9795
public static $log_history_2_delete = Log::HISTORY_DEL_RELATION;
98-
/** @var Log::HISTORY_* */
96+
/** @var Log::HISTORY_* The historical log entry action type to use for lock actions */
9997
public static $log_history_2_lock = Log::HISTORY_LOCK_RELATION;
100-
/** @var Log::HISTORY_* */
98+
/** @var Log::HISTORY_* The historical log entry action type to use for unlock actions */
10199
public static $log_history_2_unlock = Log::HISTORY_UNLOCK_RELATION;
102100

103101
// Relation between items to check

src/CommonDevice.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,9 @@ public function import(array $input)
561561
/**
562562
* Criteria used for import function
563563
*
564+
* @return array<string, string> Fieldname => Comparison type where comparison type is one of:
565+
* - 'equal': field must be equal
566+
* - 'delta:n': field must be within n of the value
564567
* @since 0.84
565568
**/
566569
public function getImportCriteria()
@@ -585,6 +588,7 @@ public function defineTabs($options = [])
585588
}
586589

587590
/**
591+
* @return void
588592
* @since 0.85
589593
**/
590594
public function post_workOnItem()

src/CommonDropdown.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ abstract class CommonDropdown extends CommonDBTM
6161
*/
6262
public $display_dropdowntitle = true;
6363

64-
//This dropdown can be translated
64+
/**
65+
* This dropdown can be translated
66+
* @var bool
67+
*/
6568
public $can_be_translated = true;
6669

6770
public static $rightname = 'dropdown';

src/DeviceFirmware.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public function rawSearchOptions()
109109
return $tab;
110110
}
111111

112+
/**
113+
* @param class-string<CommonDBTM> $itemtype
114+
* @param array $main_joinparams
115+
* @return array
116+
*/
112117
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
113118
{
114119
$tab = [];

src/DeviceGraphicCard.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ public function getImportCriteria()
204204
];
205205
}
206206

207+
/**
208+
* @param class-string<CommonDBTM> $itemtype
209+
* @param array $main_joinparams
210+
* @return array
211+
*/
207212
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
208213
{
209214
$tab = [];

src/DeviceHardDrive.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ public function getImportCriteria()
243243
];
244244
}
245245

246+
/**
247+
* @param class-string<CommonDBTM> $itemtype
248+
* @param array $main_joinparams
249+
* @return array
250+
*/
246251
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
247252
{
248253
$tab = [];

src/DeviceMemory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ public function getImportCriteria()
211211
];
212212
}
213213

214+
/**
215+
* @param class-string<CommonDBTM> $class
216+
* @param array $main_joinparams
217+
* @return array
218+
*/
214219
public static function rawSearchOptionsToAdd($class, $main_joinparams)
215220
{
216221
$tab = [];

src/DeviceMotherboard.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ public function getImportCriteria()
133133
];
134134
}
135135

136+
/**
137+
* @param class-string<CommonDBTM> $itemtype
138+
* @param array $main_joinparams
139+
* @return array
140+
*/
136141
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
137142
{
138143
$tab = [];

src/DeviceNetworkCard.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ public static function getHTMLTableHeader(
144144
}
145145
}
146146

147+
/**
148+
* @param HTMLTableRow|null $row
149+
* @param CommonDBTM|null $item
150+
* @param HTMLTableCell|null $father
151+
* @param array $options
152+
* @return void
153+
*/
147154
public static function getHTMLTableCellsForItem(
148155
?HTMLTableRow $row = null,
149156
?CommonDBTM $item = null,
@@ -203,6 +210,11 @@ public function getHTMLTableCellForItem(
203210
return $cell;
204211
}
205212

213+
/**
214+
* @param class-string<CommonDBTM> $itemtype
215+
* @param array $main_joinparams
216+
* @return array
217+
*/
206218
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
207219
{
208220
$tab = [];

src/DevicePci.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public function rawSearchOptions()
7979
return $tab;
8080
}
8181

82+
/**
83+
* @param class-string<CommonDBTM> $itemtype
84+
* @param array $main_joinparams
85+
* @return array
86+
*/
8287
public static function rawSearchOptionsToAdd($itemtype, $main_joinparams)
8388
{
8489
$tab = [];

0 commit comments

Comments
 (0)