File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed
tests/PHPStan/Rules/Arrays Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,4 @@ parameters:
33 bleedingEdge : true
44 skipCheckGenericClasses! : []
55 stricterFunctionMap : true
6-
7- reportPossiblyNonexistentStringOffset : true
6+ reportPossiblyNonexistentStringOffset : true
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ parameters:
2424 bleedingEdge : false
2525 skipCheckGenericClasses : []
2626 stricterFunctionMap : false
27+ reportPossiblyNonexistentStringOffset : false
2728 fileExtensions :
2829 - php
2930 checkAdvancedIsset : false
@@ -60,7 +61,6 @@ parameters:
6061 reportAnyTypeWideningInVarTag : false
6162 reportPossiblyNonexistentGeneralArrayOffset : false
6263 reportPossiblyNonexistentConstantArrayOffset : false
63- reportPossiblyNonexistentStringOffset : false
6464 checkMissingOverrideMethodAttribute : false
6565 mixinExcludeClasses : []
6666 scanFiles : []
@@ -825,7 +825,7 @@ services:
825825 reportMaybes : %reportMaybes%
826826 reportPossiblyNonexistentGeneralArrayOffset : %reportPossiblyNonexistentGeneralArrayOffset%
827827 reportPossiblyNonexistentConstantArrayOffset : %reportPossiblyNonexistentConstantArrayOffset%
828- reportPossiblyNonexistentStringOffset : %reportPossiblyNonexistentStringOffset%
828+ reportPossiblyNonexistentStringOffset : %featureToggles. reportPossiblyNonexistentStringOffset%
829829
830830 -
831831 class : PHPStan\Rules\ClassNameCheck
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ parametersSchema:
3030 bleedingEdge : bool (),
3131 skipCheckGenericClasses : listOf (string ()),
3232 stricterFunctionMap : bool ()
33+ reportPossiblyNonexistentStringOffset : bool ()
3334 ])
3435 fileExtensions : listOf (string ())
3536 checkAdvancedIsset : bool ()
@@ -71,7 +72,6 @@ parametersSchema:
7172 reportAnyTypeWideningInVarTag : bool ()
7273 reportPossiblyNonexistentGeneralArrayOffset : bool ()
7374 reportPossiblyNonexistentConstantArrayOffset : bool ()
74- reportPossiblyNonexistentStringOffset : bool ()
7575 checkMissingOverrideMethodAttribute : bool ()
7676 parallel : structure ([
7777 jobSize : int (),
Original file line number Diff line number Diff line change @@ -806,7 +806,7 @@ public function testBug11946(): void
806806 53 ,
807807 ],
808808 [
809- "Offset int<-5, 5> might not exist on 'hi '. " ,
809+ "Offset int<-5, 5> might not exist on 'hia '. " ,
810810 56 ,
811811 ],
812812 ]);
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function maybeNonExistentStringOffset(
4343 string $ nonEmpty ,
4444 string $ nonFalsy ,
4545 string $ lowerCase ,
46- int $ maybeWrong
46+ int $ maybeWrong, int $ oneToTwo
4747 )
4848 {
4949 echo $ s [$ maybeWrong ];
@@ -52,7 +52,10 @@ public function maybeNonExistentStringOffset(
5252 echo $ nonFalsy [$ maybeWrong ];
5353 echo $ lowerCase [$ maybeWrong ];
5454
55- $ s = 'hi ' ;
55+ $ s = 'hia ' ;
5656 echo $ s [$ maybeWrong ];
57+ if ($ maybeWrong >= 1 && $ maybeWrong < 3 ) {
58+ echo $ s [$ maybeWrong ];
59+ }
5760 }
5861}
You can’t perform that action at this time.
0 commit comments