Skip to content

Commit 92b57a5

Browse files
committed
Removed duplicate rule
1 parent 14c9389 commit 92b57a5

File tree

4 files changed

+35
-109
lines changed

4 files changed

+35
-109
lines changed

conf/config.level0.neon

-7
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ services:
175175
tags:
176176
- phpstan.rules.rule
177177

178-
-
179-
class: PHPStan\Rules\Variables\DefinedVariableInAnonymousFunctionUseRule
180-
arguments:
181-
checkMaybeUndefinedVariables: %checkMaybeUndefinedVariables%
182-
tags:
183-
- phpstan.rules.rule
184-
185178
-
186179
class: PHPStan\Rules\Regexp\RegularExpressionPatternRule
187180
tags:

src/Rules/Variables/DefinedVariableInAnonymousFunctionUseRule.php

-52
This file was deleted.

tests/PHPStan/Rules/Variables/DefinedVariableInAnonymousFunctionUseRuleTest.php

-50
This file was deleted.

tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php

+35
Original file line numberDiff line numberDiff line change
@@ -790,4 +790,39 @@ public function testFormerThisVariableRule(): void
790790
]);
791791
}
792792

793+
public function testClosureUse(): void
794+
{
795+
$this->cliArgumentsVariablesRegistered = true;
796+
$this->polluteScopeWithLoopInitialAssignments = false;
797+
$this->polluteCatchScopeWithTryAssignments = false;
798+
$this->checkMaybeUndefinedVariables = true;
799+
$this->polluteScopeWithAlwaysIterableForeach = true;
800+
$this->analyse([__DIR__ . '/data/defined-variables-anonymous-function-use.php'], [
801+
[
802+
'Variable $bar might not be defined.',
803+
5,
804+
],
805+
[
806+
'Variable $wrongErrorHandler might not be defined.',
807+
22,
808+
],
809+
[
810+
'Variable $onlyInIf might not be defined.',
811+
23,
812+
],
813+
[
814+
'Variable $forI might not be defined.',
815+
24,
816+
],
817+
[
818+
'Variable $forJ might not be defined.',
819+
25,
820+
],
821+
[
822+
'Variable $anotherVariableFromForCond might not be defined.',
823+
26,
824+
],
825+
]);
826+
}
827+
793828
}

0 commit comments

Comments
 (0)