Skip to content

Commit 6c7af52

Browse files
committed
[BUGFIX] Make class aliases available for consumers
Fixes #1532
1 parent 447fcb8 commit 6c7af52

7 files changed

Lines changed: 31 additions & 36 deletions

File tree

class-aliases/aliases.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Sabberworm\CSS\Rule\Rule;
6+
use Sabberworm\CSS\RuleSet\RuleContainer;
7+
use Sabberworm\CSS\Property\Declaration;
8+
use Sabberworm\CSS\RuleSet\DeclarationList;
9+
10+
use function Safe\class_alias;
11+
12+
/**
13+
* @deprecated in v9.2, will be removed in v10.0. Use `Property\Declaration` instead, which is a direct replacement.
14+
*/
15+
class_alias(Declaration::class, Rule::class);
16+
17+
/**
18+
* @deprecated in v9.2, will be removed in v10.0. Use `DeclarationList` instead, which is a direct replacement.
19+
*/
20+
class_alias(DeclarationList::class, RuleContainer::class);

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
"autoload": {
4747
"psr-4": {
4848
"Sabberworm\\CSS\\": "src/"
49-
}
49+
},
50+
"files": [
51+
"class-aliases/aliases.php"
52+
]
5053
},
5154
"autoload-dev": {
5255
"psr-4": {
@@ -76,9 +79,9 @@
7679
"check:dynamic": [
7780
"@check:tests"
7881
],
79-
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin config src tests",
80-
"check:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix --dry-run -v --show-progress=dots --diff bin config src tests",
81-
"check:php:lint": "parallel-lint bin config src tests",
82+
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin class-aliases config src tests",
83+
"check:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix --dry-run -v --show-progress=dots --diff bin class-aliases config src tests",
84+
"check:php:lint": "parallel-lint bin class-aliases config src tests",
8285
"check:php:rector": "rector process --no-progress-bar --dry-run --config=config/rector.php",
8386
"check:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
8487
"check:static": [
@@ -105,8 +108,8 @@
105108
"@fix:php:codesniffer",
106109
"@fix:php:fixer"
107110
],
108-
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin config src tests",
109-
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin config src tests",
111+
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin class-aliases config src tests",
112+
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin class-aliases config src tests",
110113
"fix:php:rector": "rector process --config=config/rector.php",
111114
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon --allow-empty-baseline"
112115
},

config/phpstan.neon

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ parameters:
1515
- %currentWorkingDirectory%/src/
1616
- %currentWorkingDirectory%/tests/
1717

18-
bootstrapFiles:
19-
- %currentWorkingDirectory%/src/Rule/Rule.php
20-
- %currentWorkingDirectory%/src/RuleSet/RuleContainer.php
21-
2218
type_perfect:
2319
no_mixed_property: true
2420
no_mixed_caller: true

config/rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
->withPaths(
1212
[
1313
__DIR__ . '/../bin',
14+
__DIR__ . '/../class-aliases',
1415
__DIR__ . '/../config',
1516
__DIR__ . '/../src',
1617
__DIR__ . '/../tests',

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<filter>
2020
<whitelist>
21+
<directory suffix=".php">class-alias</directory>
2122
<directory suffix=".php">src</directory>
2223
</whitelist>
2324
</filter>

src/Rule/Rule.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/RuleSet/RuleContainer.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)