@@ -41,7 +41,7 @@ abstract class CSSList implements Renderable, Commentable
41
41
protected $ comments = [];
42
42
43
43
/**
44
- * @var array<int, RuleSet|CSSList|Import|Charset>
44
+ * @var array<int<0, max> , RuleSet|CSSList|Import|Charset>
45
45
*
46
46
* @internal since 8.8.0
47
47
*/
@@ -283,11 +283,9 @@ public function append($item): void
283
283
/**
284
284
* Splices the list of contents.
285
285
*
286
- * @param int $offset
287
- * @param int $length
288
286
* @param array<int, RuleSet|CSSList|Import|Charset> $replacement
289
287
*/
290
- public function splice ($ offset , $ length = null , $ replacement = null ): void
288
+ public function splice (int $ offset , ? int $ length = null , ? array $ replacement = null ): void
291
289
{
292
290
\array_splice ($ this ->contents , $ offset , $ length , $ replacement );
293
291
}
@@ -317,13 +315,14 @@ public function insertBefore($item, $sibling): void
317
315
*
318
316
* @return bool whether the item was removed
319
317
*/
320
- public function remove ($ itemToRemove )
318
+ public function remove ($ itemToRemove ): bool
321
319
{
322
320
$ key = \array_search ($ itemToRemove , $ this ->contents , true );
323
321
if ($ key !== false ) {
324
322
unset($ this ->contents [$ key ]);
325
323
return true ;
326
324
}
325
+
327
326
return false ;
328
327
}
329
328
@@ -333,10 +332,9 @@ public function remove($itemToRemove)
333
332
* @param RuleSet|Import|Charset|CSSList $oldItem
334
333
* May be a `RuleSet` (most likely a `DeclarationBlock`), an `Import`, a `Charset`
335
334
* or another `CSSList` (most likely a `MediaQuery`)
336
- *
337
- * @return bool
335
+ * @param RuleSet|Import|Charset|CSSList|array<RuleSet|Import|Charset|CSSList> $newItem
338
336
*/
339
- public function replace ($ oldItem , $ newItem )
337
+ public function replace ($ oldItem , $ newItem ): bool
340
338
{
341
339
$ key = \array_search ($ oldItem , $ this ->contents , true );
342
340
if ($ key !== false ) {
@@ -347,6 +345,7 @@ public function replace($oldItem, $newItem)
347
345
}
348
346
return true ;
349
347
}
348
+
350
349
return false ;
351
350
}
352
351
@@ -364,10 +363,10 @@ public function setContents(array $contents): void
364
363
/**
365
364
* Removes a declaration block from the CSS list if it matches all given selectors.
366
365
*
367
- * @param DeclarationBlock|array<array-key, Selector>|string $selectors the selectors to match
366
+ * @param DeclarationBlock|array<Selector>|string $selectors the selectors to match
368
367
* @param bool $removeAll whether to stop at the first declaration block found or remove all blocks
369
368
*/
370
- public function removeDeclarationBlockBySelector ($ selectors , $ removeAll = false ): void
369
+ public function removeDeclarationBlockBySelector ($ selectors , bool $ removeAll = false ): void
371
370
{
372
371
if ($ selectors instanceof DeclarationBlock) {
373
372
$ selectors = $ selectors ->getSelectors ();
@@ -436,17 +435,15 @@ protected function renderListContents(OutputFormat $outputFormat): string
436
435
437
436
/**
438
437
* Return true if the list can not be further outdented. Only important when rendering.
439
- *
440
- * @return bool
441
438
*/
442
- abstract public function isRootList ();
439
+ abstract public function isRootList (): bool ;
443
440
444
441
/**
445
442
* Returns the stored items.
446
443
*
447
- * @return array<int, RuleSet|Import|Charset|CSSList>
444
+ * @return array<int<0, max> , RuleSet|Import|Charset|CSSList>
448
445
*/
449
- public function getContents ()
446
+ public function getContents (): array
450
447
{
451
448
return $ this ->contents ;
452
449
}
0 commit comments