@@ -17,9 +17,6 @@ class DefinedVariableRuleTest extends \PHPStan\Testing\RuleTestCase
17
17
/** @var bool */
18
18
private $ polluteScopeWithLoopInitialAssignments ;
19
19
20
- /** @var bool */
21
- private $ polluteCatchScopeWithTryAssignments ;
22
-
23
20
/** @var bool */
24
21
private $ polluteScopeWithAlwaysIterableForeach ;
25
22
@@ -36,11 +33,6 @@ protected function shouldPolluteScopeWithLoopInitialAssignments(): bool
36
33
return $ this ->polluteScopeWithLoopInitialAssignments ;
37
34
}
38
35
39
- protected function shouldPolluteCatchScopeWithTryAssignments (): bool
40
- {
41
- return $ this ->polluteCatchScopeWithTryAssignments ;
42
- }
43
-
44
36
protected function shouldPolluteScopeWithAlwaysIterableForeach (): bool
45
37
{
46
38
return $ this ->polluteScopeWithAlwaysIterableForeach ;
@@ -51,7 +43,6 @@ public function testDefinedVariables(): void
51
43
require_once __DIR__ . '/data/defined-variables-definition.php ' ;
52
44
$ this ->cliArgumentsVariablesRegistered = true ;
53
45
$ this ->polluteScopeWithLoopInitialAssignments = false ;
54
- $ this ->polluteCatchScopeWithTryAssignments = false ;
55
46
$ this ->checkMaybeUndefinedVariables = true ;
56
47
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
57
48
$ this ->analyse ([__DIR__ . '/data/defined-variables.php ' ], [
@@ -254,7 +245,6 @@ public function testDefinedVariablesInClosures(): void
254
245
{
255
246
$ this ->cliArgumentsVariablesRegistered = true ;
256
247
$ this ->polluteScopeWithLoopInitialAssignments = false ;
257
- $ this ->polluteCatchScopeWithTryAssignments = false ;
258
248
$ this ->checkMaybeUndefinedVariables = true ;
259
249
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
260
250
$ this ->analyse ([__DIR__ . '/data/defined-variables-closures.php ' ], [
@@ -269,7 +259,6 @@ public function testDefinedVariablesInShortArrayDestructuringSyntax(): void
269
259
{
270
260
$ this ->cliArgumentsVariablesRegistered = true ;
271
261
$ this ->polluteScopeWithLoopInitialAssignments = false ;
272
- $ this ->polluteCatchScopeWithTryAssignments = false ;
273
262
$ this ->checkMaybeUndefinedVariables = true ;
274
263
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
275
264
$ this ->analyse ([__DIR__ . '/data/defined-variables-array-destructuring-short-syntax.php ' ], [
@@ -292,7 +281,6 @@ public function testCliArgumentsVariablesNotRegistered(): void
292
281
{
293
282
$ this ->cliArgumentsVariablesRegistered = false ;
294
283
$ this ->polluteScopeWithLoopInitialAssignments = false ;
295
- $ this ->polluteCatchScopeWithTryAssignments = false ;
296
284
$ this ->checkMaybeUndefinedVariables = true ;
297
285
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
298
286
$ this ->analyse ([__DIR__ . '/data/cli-arguments-variables.php ' ], [
@@ -311,7 +299,6 @@ public function testCliArgumentsVariablesRegistered(): void
311
299
{
312
300
$ this ->cliArgumentsVariablesRegistered = true ;
313
301
$ this ->polluteScopeWithLoopInitialAssignments = false ;
314
- $ this ->polluteCatchScopeWithTryAssignments = false ;
315
302
$ this ->checkMaybeUndefinedVariables = true ;
316
303
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
317
304
$ this ->analyse ([__DIR__ . '/data/cli-arguments-variables.php ' ], [
@@ -370,7 +357,6 @@ public function testLoopInitialAssignments(
370
357
): void
371
358
{
372
359
$ this ->cliArgumentsVariablesRegistered = false ;
373
- $ this ->polluteCatchScopeWithTryAssignments = false ;
374
360
$ this ->polluteScopeWithLoopInitialAssignments = $ polluteScopeWithLoopInitialAssignments ;
375
361
$ this ->checkMaybeUndefinedVariables = $ checkMaybeUndefinedVariables ;
376
362
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
@@ -381,7 +367,6 @@ public function testDefineVariablesInClass(): void
381
367
{
382
368
$ this ->cliArgumentsVariablesRegistered = true ;
383
369
$ this ->polluteScopeWithLoopInitialAssignments = false ;
384
- $ this ->polluteCatchScopeWithTryAssignments = false ;
385
370
$ this ->checkMaybeUndefinedVariables = true ;
386
371
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
387
372
$ this ->analyse ([__DIR__ . '/data/define-variables-class.php ' ], []);
@@ -391,7 +376,6 @@ public function testDeadBranches(): void
391
376
{
392
377
$ this ->cliArgumentsVariablesRegistered = true ;
393
378
$ this ->polluteScopeWithLoopInitialAssignments = false ;
394
- $ this ->polluteCatchScopeWithTryAssignments = false ;
395
379
$ this ->checkMaybeUndefinedVariables = true ;
396
380
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
397
381
$ this ->analyse ([__DIR__ . '/data/dead-branches.php ' ], [
@@ -422,7 +406,6 @@ public function testForeach(): void
422
406
{
423
407
$ this ->cliArgumentsVariablesRegistered = true ;
424
408
$ this ->polluteScopeWithLoopInitialAssignments = false ;
425
- $ this ->polluteCatchScopeWithTryAssignments = false ;
426
409
$ this ->checkMaybeUndefinedVariables = true ;
427
410
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
428
411
$ this ->analyse ([__DIR__ . '/data/foreach.php ' ], [
@@ -595,7 +578,6 @@ public function testForeachPolluteScopeWithAlwaysIterableForeach(bool $polluteSc
595
578
{
596
579
$ this ->cliArgumentsVariablesRegistered = true ;
597
580
$ this ->polluteScopeWithLoopInitialAssignments = false ;
598
- $ this ->polluteCatchScopeWithTryAssignments = false ;
599
581
$ this ->checkMaybeUndefinedVariables = true ;
600
582
$ this ->polluteScopeWithAlwaysIterableForeach = $ polluteScopeWithAlwaysIterableForeach ;
601
583
$ this ->analyse ([__DIR__ . '/data/foreach-always-iterable.php ' ], $ errors );
@@ -605,7 +587,6 @@ public function testBooleanOperatorsTruthyFalsey(): void
605
587
{
606
588
$ this ->cliArgumentsVariablesRegistered = true ;
607
589
$ this ->polluteScopeWithLoopInitialAssignments = false ;
608
- $ this ->polluteCatchScopeWithTryAssignments = false ;
609
590
$ this ->checkMaybeUndefinedVariables = true ;
610
591
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
611
592
$ this ->analyse ([__DIR__ . '/data/boolean-op-truthy-falsey.php ' ], [
@@ -628,7 +609,6 @@ public function testArrowFunctions(): void
628
609
629
610
$ this ->cliArgumentsVariablesRegistered = true ;
630
611
$ this ->polluteScopeWithLoopInitialAssignments = false ;
631
- $ this ->polluteCatchScopeWithTryAssignments = false ;
632
612
$ this ->checkMaybeUndefinedVariables = true ;
633
613
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
634
614
$ this ->analyse ([__DIR__ . '/data/defined-variables-arrow-functions.php ' ], [
@@ -651,7 +631,6 @@ public function testCoalesceAssign(): void
651
631
652
632
$ this ->cliArgumentsVariablesRegistered = true ;
653
633
$ this ->polluteScopeWithLoopInitialAssignments = false ;
654
- $ this ->polluteCatchScopeWithTryAssignments = false ;
655
634
$ this ->checkMaybeUndefinedVariables = true ;
656
635
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
657
636
$ this ->analyse ([__DIR__ . '/data/defined-variables-coalesce-assign.php ' ], [
@@ -666,7 +645,6 @@ public function testBug2748(): void
666
645
{
667
646
$ this ->cliArgumentsVariablesRegistered = true ;
668
647
$ this ->polluteScopeWithLoopInitialAssignments = false ;
669
- $ this ->polluteCatchScopeWithTryAssignments = false ;
670
648
$ this ->checkMaybeUndefinedVariables = true ;
671
649
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
672
650
$ this ->analyse ([__DIR__ . '/data/bug-2748.php ' ], [
@@ -685,7 +663,6 @@ public function testGlobalVariables(): void
685
663
{
686
664
$ this ->cliArgumentsVariablesRegistered = true ;
687
665
$ this ->polluteScopeWithLoopInitialAssignments = false ;
688
- $ this ->polluteCatchScopeWithTryAssignments = false ;
689
666
$ this ->checkMaybeUndefinedVariables = true ;
690
667
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
691
668
$ this ->analyse ([__DIR__ . '/data/global-variables.php ' ], []);
@@ -695,7 +672,6 @@ public function testRootScopeMaybeDefined(): void
695
672
{
696
673
$ this ->cliArgumentsVariablesRegistered = true ;
697
674
$ this ->polluteScopeWithLoopInitialAssignments = false ;
698
- $ this ->polluteCatchScopeWithTryAssignments = false ;
699
675
$ this ->checkMaybeUndefinedVariables = false ;
700
676
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
701
677
$ this ->analyse ([__DIR__ . '/data/root-scope-maybe.php ' ], []);
@@ -705,7 +681,6 @@ public function testRootScopeMaybeDefinedCheck(): void
705
681
{
706
682
$ this ->cliArgumentsVariablesRegistered = true ;
707
683
$ this ->polluteScopeWithLoopInitialAssignments = false ;
708
- $ this ->polluteCatchScopeWithTryAssignments = false ;
709
684
$ this ->checkMaybeUndefinedVariables = true ;
710
685
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
711
686
$ this ->analyse ([__DIR__ . '/data/root-scope-maybe.php ' ], [
@@ -724,7 +699,6 @@ public function testFormerThisVariableRule(): void
724
699
{
725
700
$ this ->cliArgumentsVariablesRegistered = true ;
726
701
$ this ->polluteScopeWithLoopInitialAssignments = false ;
727
- $ this ->polluteCatchScopeWithTryAssignments = false ;
728
702
$ this ->checkMaybeUndefinedVariables = true ;
729
703
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
730
704
$ this ->analyse ([__DIR__ . '/data/this.php ' ], [
@@ -751,7 +725,6 @@ public function testClosureUse(): void
751
725
{
752
726
$ this ->cliArgumentsVariablesRegistered = true ;
753
727
$ this ->polluteScopeWithLoopInitialAssignments = false ;
754
- $ this ->polluteCatchScopeWithTryAssignments = false ;
755
728
$ this ->checkMaybeUndefinedVariables = true ;
756
729
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
757
730
$ this ->analyse ([__DIR__ . '/data/defined-variables-anonymous-function-use.php ' ], [
@@ -790,7 +763,6 @@ public function testNullsafeIsset(): void
790
763
791
764
$ this ->cliArgumentsVariablesRegistered = true ;
792
765
$ this ->polluteScopeWithLoopInitialAssignments = false ;
793
- $ this ->polluteCatchScopeWithTryAssignments = false ;
794
766
$ this ->checkMaybeUndefinedVariables = true ;
795
767
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
796
768
$ this ->analyse ([__DIR__ . '/data/variable-nullsafe-isset.php ' ], []);
@@ -800,7 +772,6 @@ public function testBug1306(): void
800
772
{
801
773
$ this ->cliArgumentsVariablesRegistered = true ;
802
774
$ this ->polluteScopeWithLoopInitialAssignments = false ;
803
- $ this ->polluteCatchScopeWithTryAssignments = false ;
804
775
$ this ->checkMaybeUndefinedVariables = true ;
805
776
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
806
777
$ this ->analyse ([__DIR__ . '/data/bug-1306.php ' ], []);
@@ -810,7 +781,6 @@ public function testBug3515(): void
810
781
{
811
782
$ this ->cliArgumentsVariablesRegistered = true ;
812
783
$ this ->polluteScopeWithLoopInitialAssignments = false ;
813
- $ this ->polluteCatchScopeWithTryAssignments = false ;
814
784
$ this ->checkMaybeUndefinedVariables = true ;
815
785
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
816
786
$ this ->analyse ([__DIR__ . '/data/bug-3515.php ' ], [
@@ -829,7 +799,6 @@ public function testBug4412(): void
829
799
{
830
800
$ this ->cliArgumentsVariablesRegistered = true ;
831
801
$ this ->polluteScopeWithLoopInitialAssignments = false ;
832
- $ this ->polluteCatchScopeWithTryAssignments = false ;
833
802
$ this ->checkMaybeUndefinedVariables = true ;
834
803
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
835
804
$ this ->analyse ([__DIR__ . '/data/bug-4412.php ' ], [
@@ -844,7 +813,6 @@ public function testBug3283(): void
844
813
{
845
814
$ this ->cliArgumentsVariablesRegistered = true ;
846
815
$ this ->polluteScopeWithLoopInitialAssignments = false ;
847
- $ this ->polluteCatchScopeWithTryAssignments = false ;
848
816
$ this ->checkMaybeUndefinedVariables = true ;
849
817
$ this ->polluteScopeWithAlwaysIterableForeach = true ;
850
818
$ this ->analyse ([__DIR__ . '/data/bug-3283.php ' ], []);
0 commit comments