Skip to content

Commit 97f2d1f

Browse files
authored
[TASK] Specify the PHPStan errors to ignore for deprecation notices (MyIntervals#1560)
Follow-up from MyIntervals#1559. `phpstan-ignore-next-line` does not have parameters - it ignores all warnings on the next line regardless (see phpstan/phpstan#11340 (comment)). `phpstan-ignore` applies to the next line, and has parameters to specify which warnings to ignore. Because the `if` statement generates two `booleanNot.alwaysTrue` warnings, this needs to be specified twice in the argument list.
1 parent 44130cf commit 97f2d1f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Rule/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class_alias(Declaration::class, Rule::class);
1313
// The test is expected to evaluate to false,
1414
// but allows for the deprecation notice to be picked up by IDEs like PHPStorm.
15-
// @phpstan-ignore-next-line booleanAnd.alwaysTrue
15+
// @phpstan-ignore booleanNot.alwaysTrue, booleanNot.alwaysTrue, booleanAnd.alwaysTrue
1616
if (!\class_exists(Rule::class, false) && !\interface_exists(Rule::class, false)) {
1717
/**
1818
* @deprecated in v9.2, will be removed in v10.0. Use `Property\Declaration` instead, which is a direct

src/RuleSet/RuleContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class_alias(DeclarationList::class, RuleContainer::class);
1111
// The test is expected to evaluate to false,
1212
// but allows for the deprecation notice to be picked up by IDEs like PHPStorm.
13-
// @phpstan-ignore-next-line booleanAnd.alwaysTrue
13+
// @phpstan-ignore booleanNot.alwaysTrue, booleanNot.alwaysTrue, booleanAnd.alwaysTrue
1414
if (!\class_exists(RuleContainer::class, false) && !\interface_exists(RuleContainer::class, false)) {
1515
/**
1616
* @deprecated in v9.2, will be removed in v10.0. Use `DeclarationList` instead, which is a direct replacement.

0 commit comments

Comments
 (0)