| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Sabberworm\CSS\RuleSet; |
| 6 |
|
| 7 |
use Sabberworm\CSS\Property\Declaration; |
| 8 |
|
| 9 |
/** |
| 10 |
* Provides a mapping of the deprecated methods in a `DeclarationList` to their renamed replacements. |
| 11 |
*/ |
| 12 |
trait LegacyDeclarationListMethods |
| 13 |
{ |
| 14 |
/** |
| 15 |
* @deprecated in v9.2, will be removed in v10.0; use `addDeclaration()` instead. |
| 16 |
*/ |
| 17 |
public function addRule(Declaration $declarationToAdd, ?Declaration $sibling = null): void |
| 18 |
{ |
| 19 |
$this->addDeclaration($declarationToAdd, $sibling); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* @deprecated in v9.2, will be removed in v10.0; use `removeDeclaration()` instead. |
| 24 |
*/ |
| 25 |
public function removeRule(Declaration $declarationToRemove): void |
| 26 |
{ |
| 27 |
$this->removeDeclaration($declarationToRemove); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* @deprecated in v9.2, will be removed in v10.0; use `removeMatchingDeclarations()` instead. |
| 32 |
*/ |
| 33 |
public function removeMatchingRules(string $searchPattern): void |
| 34 |
{ |
| 35 |
$this->removeMatchingDeclarations($searchPattern); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* @deprecated in v9.2, will be removed in v10.0; use `removeAllDeclarations()` instead. |
| 40 |
*/ |
| 41 |
public function removeAllRules(): void |
| 42 |
{ |
| 43 |
$this->removeAllDeclarations(); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* @param array<Declaration> $declarations |
| 48 |
* |
| 49 |
* @deprecated in v9.2, will be removed in v10.0; use `setDeclarations()` instead. |
| 50 |
*/ |
| 51 |
public function setRules(array $declarations): void |
| 52 |
{ |
| 53 |
$this->setDeclarations($declarations); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* @return array<int<0, max>, Declaration> |
| 58 |
* |
| 59 |
* @deprecated in v9.2, will be removed in v10.0; use `getDeclarations()` instead. |
| 60 |
*/ |
| 61 |
public function getRules(?string $searchPattern = null): array |
| 62 |
{ |
| 63 |
return $this->getDeclarations($searchPattern); |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* @return array<string, Declaration> |
| 68 |
* |
| 69 |
* @deprecated in v9.2, will be removed in v10.0; use `getDeclarationsAssociative()` instead. |
| 70 |
*/ |
| 71 |
public function getRulesAssoc(?string $searchPattern = null): array |
| 72 |
{ |
| 73 |
return $this->getDeclarationsAssociative($searchPattern); |
| 74 |
} |
| 75 |
} |