Skip to content

Commit 9054919

Browse files
committed
[BUGFIX] Avoid double autoloading of class aliases
1 parent dfdf183 commit 9054919

8 files changed

Lines changed: 42 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Please also have a look at our
2020

2121
### Fixed
2222

23+
- Avoid double autoloading of class aliases (#1552)
24+
2325
### Documentation
2426

2527
## 9.2.0: New features and deprecations

class-aliases/Rule/Rule.php

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

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"Sabberworm\\CSS\\": "src/"
4949
},
5050
"files": [
51-
"src/Rule/Rule.php",
52-
"src/RuleSet/RuleContainer.php"
51+
"class-aliases/Rule/Rule.php",
52+
"class-aliases/RuleSet/RuleContainer.php"
5353
]
5454
},
5555
"autoload-dev": {
@@ -80,9 +80,9 @@
8080
"check:dynamic": [
8181
"@check:tests"
8282
],
83-
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin config src tests",
84-
"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",
85-
"check:php:lint": "parallel-lint bin config src tests",
83+
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin class-aliases config src tests",
84+
"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",
85+
"check:php:lint": "parallel-lint bin class-aliases config src tests",
8686
"check:php:rector": "rector process --no-progress-bar --dry-run --config=config/rector.php",
8787
"check:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
8888
"check:static": [
@@ -109,8 +109,8 @@
109109
"@fix:php:codesniffer",
110110
"@fix:php:fixer"
111111
],
112-
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin config src tests",
113-
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin config src tests",
112+
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin class-aliases config src tests",
113+
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin class-aliases config src tests",
114114
"fix:php:rector": "rector process --config=config/rector.php",
115115
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon --allow-empty-baseline",
116116
"phpstan:clearcache": "phpstan clear-result-cache"

config/phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ parameters:
88

99
paths:
1010
- %currentWorkingDirectory%/bin/
11+
- %currentWorkingDirectory%/class-aliases/
1112
- %currentWorkingDirectory%/src/
1213
- %currentWorkingDirectory%/tests/
1314

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',

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)