Skip to content

Commit 84fb578

Browse files
phpstan-botclaude
andcommitted
Rename checkPurity parameter to reportMethodPurityOverride for consistency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6aad76c commit 84fb578

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

conf/services.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ services:
9898
arguments:
9999
reportMaybes: %reportMaybesInMethodSignatures%
100100
reportStatic: %reportStaticMethodSignatures%
101-
checkPurity: %featureToggles.reportMethodPurityOverride%
101+
reportMethodPurityOverride: %featureToggles.reportMethodPurityOverride%
102102

103103
phpstanDiagnoseExtension:
104104
class: PHPStan\Diagnose\PHPStanDiagnoseExtension

src/Rules/Methods/MethodSignatureRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
private ParentMethodHelper $parentMethodHelper,
4242
private bool $reportMaybes,
4343
private bool $reportStatic,
44-
private bool $checkPurity,
44+
private bool $reportMethodPurityOverride,
4545
)
4646
{
4747
}
@@ -67,7 +67,7 @@ public function processNode(Node $node, Scope $scope): array
6767
$errors = [];
6868
$declaringClass = $method->getDeclaringClass();
6969
foreach ($this->parentMethodHelper->collectParentMethods($methodName, $method->getDeclaringClass()) as [$parentMethod, $parentMethodDeclaringClass]) {
70-
if ($this->checkPurity && $method->isPure()->no() && $parentMethod->isPure()->yes()) {
70+
if ($this->reportMethodPurityOverride && $method->isPure()->no() && $parentMethod->isPure()->yes()) {
7171
$errors[] = RuleErrorBuilder::message(sprintf(
7272
'Impure method %s::%s() overrides pure method %s::%s().',
7373
$method->getDeclaringClass()->getDisplayName(),

tests/PHPStan/Rules/Methods/MethodSignatureRuleTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MethodSignatureRuleTest extends RuleTestCase
1919

2020
private bool $reportStatic;
2121

22-
private bool $checkPurity = false;
22+
private bool $reportMethodPurityOverride = false;
2323

2424
protected function getRule(): Rule
2525
{
@@ -29,7 +29,7 @@ protected function getRule(): Rule
2929

3030
return new OverridingMethodRule(
3131
$phpVersion,
32-
new MethodSignatureRule(new ParentMethodHelper($phpClassReflectionExtension), $this->reportMaybes, $this->reportStatic, $this->checkPurity),
32+
new MethodSignatureRule(new ParentMethodHelper($phpClassReflectionExtension), $this->reportMaybes, $this->reportStatic, $this->reportMethodPurityOverride),
3333
true,
3434
new MethodParameterComparisonHelper($phpVersion),
3535
new MethodVisibilityComparisonHelper(),
@@ -571,7 +571,7 @@ public function testBug14563(): void
571571
{
572572
$this->reportMaybes = true;
573573
$this->reportStatic = true;
574-
$this->checkPurity = true;
574+
$this->reportMethodPurityOverride = true;
575575
$this->analyse([__DIR__ . '/data/bug-14563.php'], [
576576
[
577577
'Impure method Bug14563\ChildImpureOverridesPure::pure() overrides pure method Bug14563\Foo::pure().',
@@ -617,7 +617,7 @@ public function testBug14563Trait(): void
617617
{
618618
$this->reportMaybes = true;
619619
$this->reportStatic = true;
620-
$this->checkPurity = true;
620+
$this->reportMethodPurityOverride = true;
621621
$this->analyse([__DIR__ . '/data/bug-14563-trait.php'], [
622622
[
623623
'Impure method Bug14563Trait\ImpureTraitUser::pureTraitMethod() overrides pure method Bug14563Trait\PureTrait::pureTraitMethod().',

0 commit comments

Comments
 (0)