@@ -17,9 +17,6 @@ class DefinedVariableRuleTest extends \PHPStan\Testing\RuleTestCase
1717 /** @var bool */
1818 private $ polluteScopeWithLoopInitialAssignments ;
1919
20- /** @var bool */
21- private $ polluteCatchScopeWithTryAssignments ;
22-
2320 /** @var bool */
2421 private $ polluteScopeWithAlwaysIterableForeach ;
2522
@@ -36,11 +33,6 @@ protected function shouldPolluteScopeWithLoopInitialAssignments(): bool
3633 return $ this ->polluteScopeWithLoopInitialAssignments ;
3734 }
3835
39- protected function shouldPolluteCatchScopeWithTryAssignments (): bool
40- {
41- return $ this ->polluteCatchScopeWithTryAssignments ;
42- }
43-
4436 protected function shouldPolluteScopeWithAlwaysIterableForeach (): bool
4537 {
4638 return $ this ->polluteScopeWithAlwaysIterableForeach ;
@@ -51,7 +43,6 @@ public function testDefinedVariables(): void
5143 require_once __DIR__ . '/data/defined-variables-definition.php ' ;
5244 $ this ->cliArgumentsVariablesRegistered = true ;
5345 $ this ->polluteScopeWithLoopInitialAssignments = false ;
54- $ this ->polluteCatchScopeWithTryAssignments = false ;
5546 $ this ->checkMaybeUndefinedVariables = true ;
5647 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
5748 $ this ->analyse ([__DIR__ . '/data/defined-variables.php ' ], [
@@ -254,7 +245,6 @@ public function testDefinedVariablesInClosures(): void
254245 {
255246 $ this ->cliArgumentsVariablesRegistered = true ;
256247 $ this ->polluteScopeWithLoopInitialAssignments = false ;
257- $ this ->polluteCatchScopeWithTryAssignments = false ;
258248 $ this ->checkMaybeUndefinedVariables = true ;
259249 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
260250 $ this ->analyse ([__DIR__ . '/data/defined-variables-closures.php ' ], [
@@ -269,7 +259,6 @@ public function testDefinedVariablesInShortArrayDestructuringSyntax(): void
269259 {
270260 $ this ->cliArgumentsVariablesRegistered = true ;
271261 $ this ->polluteScopeWithLoopInitialAssignments = false ;
272- $ this ->polluteCatchScopeWithTryAssignments = false ;
273262 $ this ->checkMaybeUndefinedVariables = true ;
274263 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
275264 $ this ->analyse ([__DIR__ . '/data/defined-variables-array-destructuring-short-syntax.php ' ], [
@@ -292,7 +281,6 @@ public function testCliArgumentsVariablesNotRegistered(): void
292281 {
293282 $ this ->cliArgumentsVariablesRegistered = false ;
294283 $ this ->polluteScopeWithLoopInitialAssignments = false ;
295- $ this ->polluteCatchScopeWithTryAssignments = false ;
296284 $ this ->checkMaybeUndefinedVariables = true ;
297285 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
298286 $ this ->analyse ([__DIR__ . '/data/cli-arguments-variables.php ' ], [
@@ -311,7 +299,6 @@ public function testCliArgumentsVariablesRegistered(): void
311299 {
312300 $ this ->cliArgumentsVariablesRegistered = true ;
313301 $ this ->polluteScopeWithLoopInitialAssignments = false ;
314- $ this ->polluteCatchScopeWithTryAssignments = false ;
315302 $ this ->checkMaybeUndefinedVariables = true ;
316303 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
317304 $ this ->analyse ([__DIR__ . '/data/cli-arguments-variables.php ' ], [
@@ -370,7 +357,6 @@ public function testLoopInitialAssignments(
370357 ): void
371358 {
372359 $ this ->cliArgumentsVariablesRegistered = false ;
373- $ this ->polluteCatchScopeWithTryAssignments = false ;
374360 $ this ->polluteScopeWithLoopInitialAssignments = $ polluteScopeWithLoopInitialAssignments ;
375361 $ this ->checkMaybeUndefinedVariables = $ checkMaybeUndefinedVariables ;
376362 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
@@ -381,7 +367,6 @@ public function testDefineVariablesInClass(): void
381367 {
382368 $ this ->cliArgumentsVariablesRegistered = true ;
383369 $ this ->polluteScopeWithLoopInitialAssignments = false ;
384- $ this ->polluteCatchScopeWithTryAssignments = false ;
385370 $ this ->checkMaybeUndefinedVariables = true ;
386371 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
387372 $ this ->analyse ([__DIR__ . '/data/define-variables-class.php ' ], []);
@@ -391,7 +376,6 @@ public function testDeadBranches(): void
391376 {
392377 $ this ->cliArgumentsVariablesRegistered = true ;
393378 $ this ->polluteScopeWithLoopInitialAssignments = false ;
394- $ this ->polluteCatchScopeWithTryAssignments = false ;
395379 $ this ->checkMaybeUndefinedVariables = true ;
396380 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
397381 $ this ->analyse ([__DIR__ . '/data/dead-branches.php ' ], [
@@ -422,7 +406,6 @@ public function testForeach(): void
422406 {
423407 $ this ->cliArgumentsVariablesRegistered = true ;
424408 $ this ->polluteScopeWithLoopInitialAssignments = false ;
425- $ this ->polluteCatchScopeWithTryAssignments = false ;
426409 $ this ->checkMaybeUndefinedVariables = true ;
427410 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
428411 $ this ->analyse ([__DIR__ . '/data/foreach.php ' ], [
@@ -595,7 +578,6 @@ public function testForeachPolluteScopeWithAlwaysIterableForeach(bool $polluteSc
595578 {
596579 $ this ->cliArgumentsVariablesRegistered = true ;
597580 $ this ->polluteScopeWithLoopInitialAssignments = false ;
598- $ this ->polluteCatchScopeWithTryAssignments = false ;
599581 $ this ->checkMaybeUndefinedVariables = true ;
600582 $ this ->polluteScopeWithAlwaysIterableForeach = $ polluteScopeWithAlwaysIterableForeach ;
601583 $ this ->analyse ([__DIR__ . '/data/foreach-always-iterable.php ' ], $ errors );
@@ -605,7 +587,6 @@ public function testBooleanOperatorsTruthyFalsey(): void
605587 {
606588 $ this ->cliArgumentsVariablesRegistered = true ;
607589 $ this ->polluteScopeWithLoopInitialAssignments = false ;
608- $ this ->polluteCatchScopeWithTryAssignments = false ;
609590 $ this ->checkMaybeUndefinedVariables = true ;
610591 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
611592 $ this ->analyse ([__DIR__ . '/data/boolean-op-truthy-falsey.php ' ], [
@@ -628,7 +609,6 @@ public function testArrowFunctions(): void
628609
629610 $ this ->cliArgumentsVariablesRegistered = true ;
630611 $ this ->polluteScopeWithLoopInitialAssignments = false ;
631- $ this ->polluteCatchScopeWithTryAssignments = false ;
632612 $ this ->checkMaybeUndefinedVariables = true ;
633613 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
634614 $ this ->analyse ([__DIR__ . '/data/defined-variables-arrow-functions.php ' ], [
@@ -651,7 +631,6 @@ public function testCoalesceAssign(): void
651631
652632 $ this ->cliArgumentsVariablesRegistered = true ;
653633 $ this ->polluteScopeWithLoopInitialAssignments = false ;
654- $ this ->polluteCatchScopeWithTryAssignments = false ;
655634 $ this ->checkMaybeUndefinedVariables = true ;
656635 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
657636 $ this ->analyse ([__DIR__ . '/data/defined-variables-coalesce-assign.php ' ], [
@@ -666,7 +645,6 @@ public function testBug2748(): void
666645 {
667646 $ this ->cliArgumentsVariablesRegistered = true ;
668647 $ this ->polluteScopeWithLoopInitialAssignments = false ;
669- $ this ->polluteCatchScopeWithTryAssignments = false ;
670648 $ this ->checkMaybeUndefinedVariables = true ;
671649 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
672650 $ this ->analyse ([__DIR__ . '/data/bug-2748.php ' ], [
@@ -685,7 +663,6 @@ public function testGlobalVariables(): void
685663 {
686664 $ this ->cliArgumentsVariablesRegistered = true ;
687665 $ this ->polluteScopeWithLoopInitialAssignments = false ;
688- $ this ->polluteCatchScopeWithTryAssignments = false ;
689666 $ this ->checkMaybeUndefinedVariables = true ;
690667 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
691668 $ this ->analyse ([__DIR__ . '/data/global-variables.php ' ], []);
@@ -695,7 +672,6 @@ public function testRootScopeMaybeDefined(): void
695672 {
696673 $ this ->cliArgumentsVariablesRegistered = true ;
697674 $ this ->polluteScopeWithLoopInitialAssignments = false ;
698- $ this ->polluteCatchScopeWithTryAssignments = false ;
699675 $ this ->checkMaybeUndefinedVariables = false ;
700676 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
701677 $ this ->analyse ([__DIR__ . '/data/root-scope-maybe.php ' ], []);
@@ -705,7 +681,6 @@ public function testRootScopeMaybeDefinedCheck(): void
705681 {
706682 $ this ->cliArgumentsVariablesRegistered = true ;
707683 $ this ->polluteScopeWithLoopInitialAssignments = false ;
708- $ this ->polluteCatchScopeWithTryAssignments = false ;
709684 $ this ->checkMaybeUndefinedVariables = true ;
710685 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
711686 $ this ->analyse ([__DIR__ . '/data/root-scope-maybe.php ' ], [
@@ -724,7 +699,6 @@ public function testFormerThisVariableRule(): void
724699 {
725700 $ this ->cliArgumentsVariablesRegistered = true ;
726701 $ this ->polluteScopeWithLoopInitialAssignments = false ;
727- $ this ->polluteCatchScopeWithTryAssignments = false ;
728702 $ this ->checkMaybeUndefinedVariables = true ;
729703 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
730704 $ this ->analyse ([__DIR__ . '/data/this.php ' ], [
@@ -751,7 +725,6 @@ public function testClosureUse(): void
751725 {
752726 $ this ->cliArgumentsVariablesRegistered = true ;
753727 $ this ->polluteScopeWithLoopInitialAssignments = false ;
754- $ this ->polluteCatchScopeWithTryAssignments = false ;
755728 $ this ->checkMaybeUndefinedVariables = true ;
756729 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
757730 $ this ->analyse ([__DIR__ . '/data/defined-variables-anonymous-function-use.php ' ], [
@@ -790,7 +763,6 @@ public function testNullsafeIsset(): void
790763
791764 $ this ->cliArgumentsVariablesRegistered = true ;
792765 $ this ->polluteScopeWithLoopInitialAssignments = false ;
793- $ this ->polluteCatchScopeWithTryAssignments = false ;
794766 $ this ->checkMaybeUndefinedVariables = true ;
795767 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
796768 $ this ->analyse ([__DIR__ . '/data/variable-nullsafe-isset.php ' ], []);
@@ -800,7 +772,6 @@ public function testBug1306(): void
800772 {
801773 $ this ->cliArgumentsVariablesRegistered = true ;
802774 $ this ->polluteScopeWithLoopInitialAssignments = false ;
803- $ this ->polluteCatchScopeWithTryAssignments = false ;
804775 $ this ->checkMaybeUndefinedVariables = true ;
805776 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
806777 $ this ->analyse ([__DIR__ . '/data/bug-1306.php ' ], []);
@@ -810,7 +781,6 @@ public function testBug3515(): void
810781 {
811782 $ this ->cliArgumentsVariablesRegistered = true ;
812783 $ this ->polluteScopeWithLoopInitialAssignments = false ;
813- $ this ->polluteCatchScopeWithTryAssignments = false ;
814784 $ this ->checkMaybeUndefinedVariables = true ;
815785 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
816786 $ this ->analyse ([__DIR__ . '/data/bug-3515.php ' ], [
@@ -829,7 +799,6 @@ public function testBug4412(): void
829799 {
830800 $ this ->cliArgumentsVariablesRegistered = true ;
831801 $ this ->polluteScopeWithLoopInitialAssignments = false ;
832- $ this ->polluteCatchScopeWithTryAssignments = false ;
833802 $ this ->checkMaybeUndefinedVariables = true ;
834803 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
835804 $ this ->analyse ([__DIR__ . '/data/bug-4412.php ' ], [
@@ -844,7 +813,6 @@ public function testBug3283(): void
844813 {
845814 $ this ->cliArgumentsVariablesRegistered = true ;
846815 $ this ->polluteScopeWithLoopInitialAssignments = false ;
847- $ this ->polluteCatchScopeWithTryAssignments = false ;
848816 $ this ->checkMaybeUndefinedVariables = true ;
849817 $ this ->polluteScopeWithAlwaysIterableForeach = true ;
850818 $ this ->analyse ([__DIR__ . '/data/bug-3283.php ' ], []);
0 commit comments