Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Please also have a look at our

### Fixed

- Avoid double autoloading of class aliases (#1552)

### Documentation

## 9.2.0: New features and deprecations
Expand Down
17 changes: 17 additions & 0 deletions class-aliases/Rule/Rule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Sabberworm\CSS\Rule;

use Sabberworm\CSS\Property\Declaration;

use function Safe\class_alias;

if (!\class_exists(Rule::class) && !\interface_exists(Rule::class)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass false as the second argument to class_exists() and interface_exists() to avoid any unwanted autoloading.

/**
* @deprecated in v9.2, will be removed in v10.0. Use `Property\Declaration` instead, which is a direct
* replacement.
*/
class_alias(Declaration::class, Rule::class);
}
14 changes: 14 additions & 0 deletions class-aliases/RuleSet/RuleContainer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Sabberworm\CSS\RuleSet;

use function Safe\class_alias;

if (!\class_exists(RuleContainer::class) && !\interface_exists(RuleContainer::class)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass false as the second argument to class_exists() and interface_exists() to avoid any unwanted autoloading.

/**
* @deprecated in v9.2, will be removed in v10.0. Use `DeclarationList` instead, which is a direct replacement.
*/
class_alias(DeclarationList::class, RuleContainer::class);
}
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"Sabberworm\\CSS\\": "src/"
},
"files": [
"src/Rule/Rule.php",
"src/RuleSet/RuleContainer.php"
"class-aliases/Rule/Rule.php",
"class-aliases/RuleSet/RuleContainer.php"
]
},
"autoload-dev": {
Expand Down Expand Up @@ -80,9 +80,9 @@
"check:dynamic": [
"@check:tests"
],
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin config src tests",
"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",
"check:php:lint": "parallel-lint bin config src tests",
"check:php:codesniffer": "phpcs --standard=config/phpcs.xml bin class-aliases config src tests",
"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",
"check:php:lint": "parallel-lint bin class-aliases config src tests",
"check:php:rector": "rector process --no-progress-bar --dry-run --config=config/rector.php",
"check:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
"check:static": [
Expand All @@ -109,8 +109,8 @@
"@fix:php:codesniffer",
"@fix:php:fixer"
],
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin config src tests",
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin config src tests",
"fix:php:codesniffer": "phpcbf --standard=config/phpcs.xml bin class-aliases config src tests",
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin class-aliases config src tests",
"fix:php:rector": "rector process --config=config/rector.php",
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon --allow-empty-baseline",
"phpstan:clearcache": "phpstan clear-result-cache"
Expand Down
1 change: 1 addition & 0 deletions config/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parameters:

paths:
- %currentWorkingDirectory%/bin/
- %currentWorkingDirectory%/class-aliases/
- %currentWorkingDirectory%/src/
- %currentWorkingDirectory%/tests/

Expand Down
1 change: 1 addition & 0 deletions config/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
->withPaths(
[
__DIR__ . '/../bin',
__DIR__ . '/../class-aliases',
__DIR__ . '/../config',
__DIR__ . '/../src',
__DIR__ . '/../tests',
Expand Down
14 changes: 0 additions & 14 deletions src/Rule/Rule.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/RuleSet/RuleContainer.php

This file was deleted.