Skip to content

Commit d3c9cef

Browse files
committed
docs: update docblocks
1 parent 6db7ad7 commit d3c9cef

File tree

8 files changed

+24
-14
lines changed

8 files changed

+24
-14
lines changed

hook.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ function plugin_carbon_postShowTab(array $param)
153153
/**
154154
* Add search options to core itemtypes
155155
*
156-
* @param string $itemtype
156+
* @template T of CommonDBTM
157+
* @param class-string<T> $itemtype
157158
* @return array
158159
*/
159160
function plugin_carbon_getAddSearchOptionsNew($itemtype): array

src/CarbonEmission.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ public function rawSearchOptions()
172172
* Gaps are returned as an array of start and end
173173
* where start is the 1st msising date and end is the last missing date
174174
*
175+
* @template T of CommonDBTM
176+
* @param class-string<T> $itemtype
175177
* @param integer $id
176178
* @param DateTimeInterface|null $start
177179
* @param DateTimeInterface|null $stop

src/Dashboard/Provider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ public static function getHandledAssetsRatio(array $params = [])
459459
*
460460
* Handled assets are assets with enough data to calculate usage carbon emission
461461
*
462-
* @param array|string $itemtypes types of asets to count
462+
* @template T of CommonDBTM
463+
* @param array[class-string<T>]|class-string<T> $itemtypes types of asets to count
463464
* @param array $params
464465
* @return array
465466
*/

src/EmbodiedImpact.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public function rawSearchOptions()
140140
/**
141141
* Get iterator of items without known embodied impact for a specified itemtype
142142
*
143-
* @param string $itemtype
143+
* @template T of CommonDBTM
144+
* @param class-string<T> $itemtype
144145
* @param array $crit Criteria array of WHERE, ORDER, GROUP BY, LEFT JOIN, INNER JOIN, RIGHT JOIN, HAVING, LIMIT
145146
* @return DBmysqlIterator
146147
*/

src/Engine/V1/Inventory.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
use DateTime;
3636
use Computer as GlpiComputer;
3737
use DbUtils;
38-
use GlpiPlugin\Carbon\Zone;
3938
use GlpiPlugin\Carbon\DataTracking\TrackedFloat;
4039
use GlpiPlugin\Carbon\DataTracking\TrackedInt;
4140
use GlpiPlugin\Carbon\Source_Zone;
42-
use GlpiPlugin\Carbon\Tests\Engine\V1\EngineTestCase;
4341

4442
/**
4543
* Compute environmental impact of a whole inventory
@@ -56,7 +54,8 @@ class Inventory implements EngineInterface
5654
/**
5755
* Check an item is already in the inventory
5856
*
59-
* @param string $itemtype
57+
* @template T of CommonDBTM
58+
* @param class-string<T> $itemtype
6059
* @param integer $items_id
6160
* @return boolean
6261
*/
@@ -69,7 +68,8 @@ public function hasItem(string $itemtype, int $items_id)
6968
/**
7069
* Is the itemtype an asset ?
7170
*
72-
* @param string $itemtype
71+
* @template T of CommonDBTM
72+
* @param class-string<T> $itemtype
7373
* @return boolean
7474
*/
7575
private static function isAsset(string $itemtype): bool
@@ -83,7 +83,8 @@ private static function isAsset(string $itemtype): bool
8383
/**
8484
* Add an item to the inventory to be processed
8585
*
86-
* @param string $itemtype
86+
* @template T of CommonDBTM
87+
* @param class-string<T> $itemtype
8788
* @param integer $items_id
8889
* @return boolean
8990
*/
@@ -125,7 +126,8 @@ public function addItem(string $itemtype, int $items_id): bool
125126
/**
126127
* Add several items to the inventory by itemtype and a search criteria
127128
*
128-
* @param string $itemtype itemtype of the items to add
129+
* @template T of CommonDBTM
130+
* @param class-string<T> $itemtype itemtype of the items to add
129131
* @param array $crit search criteria of items to add
130132
* @return boolean true if success
131133
*/

src/Impact/Embodied/Engine.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public static function getAvailableBackends(): array
5656
*
5757
* Returns null if no engine found
5858
*
59-
* @param string $itemtype itemtype of assets to analyze
59+
* @template T of CommonDBTM
60+
* @param class-string<T> $itemtype itemtype of assets to analyze
6061
* @return EmbodiedImpactInterface|null an instance if an embodied impact calculation object or null on error
6162
*/
6263
public static function getEngineFromItemtype(string $itemtype): ?EmbodiedImpactInterface
@@ -82,7 +83,8 @@ public static function getEngineFromItemtype(string $itemtype): ?EmbodiedImpactI
8283
* Get an instance of the internal engine to calcilate impacts for the given itemtype
8384
* This is a fallback engine
8485
*
85-
* @param string $itemtype
86+
* @template T of CommonDBTM
87+
* @param class-string<T> $itemtype
8688
* @return ?EmbodiedImpactInterface
8789
*/
8890
public static function getInternalEngineFromItemtype(string $itemtype): ?EmbodiedImpactInterface

src/Impact/Usage/Engine.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public static function getAvailableBackends(): array
5555
*
5656
* Returns null if no engine found
5757
*
58-
* @param string $itemtype itemtype of assets to analyze
58+
* @template T of CommonDBTM
59+
* @param class-string<T> $itemtype itemtype of assets to analyze
5960
* @return AbstractUsageImpact|null an instance if an embodied impact calculation object or null on error
6061
*/
6162
public static function getEngineFromItemtype(string $itemtype): ?AbstractUsageImpact

src/Zone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public function rawSearchOptions()
190190

191191
/**
192192
* Get the request fragment to find a zone by asset
193-
*
194-
* @param class-string $itemtype asset type
193+
* @template T of CommonDBTM
194+
* @param class-string<T> $itemtype asset type
195195
* @return array Request fragment
196196
*/
197197
private static function getByAssetRequest(string $itemtype): array

0 commit comments

Comments
 (0)