Skip to content

Commit 81bebdd

Browse files
committed
IssetCheck - remove bleeding edge condition so that undefined variables are always reported
1 parent 2e858de commit 81bebdd

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

conf/config.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ services:
864864
-
865865
class: PHPStan\Rules\IssetCheck
866866
arguments:
867-
bleedingEdge: %featureToggles.bleedingEdge%
868867
checkAdvancedIsset: %checkAdvancedIsset%
869868

870869
-

src/Rules/IssetCheck.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@ class IssetCheck
2020

2121
private bool $checkAdvancedIsset;
2222

23-
private bool $bleedingEdge;
24-
2523
public function __construct(
2624
PropertyDescriptor $propertyDescriptor,
2725
PropertyReflectionFinder $propertyReflectionFinder,
28-
bool $checkAdvancedIsset,
29-
bool $bleedingEdge
26+
bool $checkAdvancedIsset
3027
)
3128
{
3229
$this->propertyDescriptor = $propertyDescriptor;
3330
$this->propertyReflectionFinder = $propertyReflectionFinder;
3431
$this->checkAdvancedIsset = $checkAdvancedIsset;
35-
$this->bleedingEdge = $bleedingEdge;
3632
}
3733

3834
/**
@@ -46,10 +42,7 @@ public function check(Expr $expr, Scope $scope, string $operatorDescription, cal
4642
return null;
4743
}
4844

49-
if (
50-
$error === null
51-
&& $this->bleedingEdge
52-
) {
45+
if ($error === null) {
5346
if ($hasVariable->yes()) {
5447
if ($expr->name === '_SESSION') {
5548
return null;

tests/PHPStan/Rules/Variables/EmptyRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EmptyRuleTest extends RuleTestCase
1515

1616
protected function getRule(): \PHPStan\Rules\Rule
1717
{
18-
return new EmptyRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true, true));
18+
return new EmptyRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true));
1919
}
2020

2121
public function testRule(): void

tests/PHPStan/Rules/Variables/IssetRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IssetRuleTest extends RuleTestCase
1616

1717
protected function getRule(): Rule
1818
{
19-
return new IssetRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true, true));
19+
return new IssetRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true));
2020
}
2121

2222
public function testRule(): void

tests/PHPStan/Rules/Variables/NullCoalesceRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NullCoalesceRuleTest extends \PHPStan\Testing\RuleTestCase
1414

1515
protected function getRule(): \PHPStan\Rules\Rule
1616
{
17-
return new NullCoalesceRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true, true));
17+
return new NullCoalesceRule(new IssetCheck(new PropertyDescriptor(), new PropertyReflectionFinder(), true));
1818
}
1919

2020
public function testCoalesceRule(): void

0 commit comments

Comments
 (0)