Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions Build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ parameters:
count: 2
path: ../../src/Property/Selector/SpecificityCalculator.php

-
message: '#^Function class_alias is unsafe to use\. It can return FALSE instead of throwing an exception\. Please add ''use function Safe\\class_alias;'' at the beginning of the file to use the variant provided by the ''thecodingmachine/safe'' library\.$#'
identifier: theCodingMachineSafe.function
count: 1
path: ../../src/Rule/Rule.php

-
message: '#^Function class_alias is unsafe to use\. It can return FALSE instead of throwing an exception\. Please add ''use function Safe\\class_alias;'' at the beginning of the file to use the variant provided by the ''thecodingmachine/safe'' library\.$#'
identifier: theCodingMachineSafe.function
count: 1
path: ../../src/RuleSet/RuleContainer.php

-
message: '#^Parameter \#2 \$arguments of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects array\<Sabberworm\\CSS\\Value\\Value\|string\>\|Sabberworm\\CSS\\Value\\RuleValueList, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
identifier: argument.type
Expand Down
7 changes: 3 additions & 4 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

use Sabberworm\CSS\Property\Declaration;

use function Safe\class_alias;

// @phpstan-ignore function.impossibleType
if (!\class_exists(Rule::class, false) && !\interface_exists(Rule::class, false)) {
class_alias(Declaration::class, Rule::class);
$aliasWasCreated = \class_alias(Declaration::class, Rule::class);
\assert($aliasWasCreated);
// The test is expected to evaluate to false,
// but allows for the deprecation notice to be picked up by IDEs like PHPStorm.
// @phpstan-ignore function.impossibleType
// @phpstan-ignore function.impossibleType, booleanNot.alwaysTrue, booleanAnd.alwaysTrue
if (!\class_exists(Rule::class, false) && !\interface_exists(Rule::class, false)) {
/**
* @deprecated in v9.2, will be removed in v10.0. Use `Property\Declaration` instead, which is a direct
Expand Down
7 changes: 3 additions & 4 deletions src/RuleSet/RuleContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

namespace Sabberworm\CSS\RuleSet;

use function Safe\class_alias;

// @phpstan-ignore function.impossibleType
if (!\class_exists(RuleContainer::class, false) && !\interface_exists(RuleContainer::class, false)) {
class_alias(DeclarationList::class, RuleContainer::class);
$aliasWasCreated = \class_alias(DeclarationList::class, RuleContainer::class);
\assert($aliasWasCreated);
// The test is expected to evaluate to false,
// but allows for the deprecation notice to be picked up by IDEs like PHPStorm.
// @phpstan-ignore function.impossibleType
// @phpstan-ignore function.impossibleType, booleanNot.alwaysTrue, booleanAnd.alwaysTrue
if (!\class_exists(RuleContainer::class, false) && !\interface_exists(RuleContainer::class, false)) {
/**
* @deprecated in v9.2, will be removed in v10.0. Use `DeclarationList` instead, which is a direct replacement.
Expand Down