File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
tests/PHPStan/Rules/Arrays Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ parameters:
2626 skipCheckGenericClasses : []
2727 stricterFunctionMap : false
2828 reportPreciseLineForUnusedFunctionParameter : false
29+ reportPossiblyNonexistentStringOffset : false
2930 fileExtensions :
3031 - php
3132 checkAdvancedIsset : false
@@ -63,7 +64,6 @@ parameters:
6364 reportAnyTypeWideningInVarTag : false
6465 reportPossiblyNonexistentGeneralArrayOffset : false
6566 reportPossiblyNonexistentConstantArrayOffset : false
66- reportPossiblyNonexistentStringOffset : false
6767 checkMissingOverrideMethodAttribute : false
6868 mixinExcludeClasses : []
6969 scanFiles : []
@@ -838,7 +838,7 @@ services:
838838 reportMaybes : %reportMaybes%
839839 reportPossiblyNonexistentGeneralArrayOffset : %reportPossiblyNonexistentGeneralArrayOffset%
840840 reportPossiblyNonexistentConstantArrayOffset : %reportPossiblyNonexistentConstantArrayOffset%
841- reportPossiblyNonexistentStringOffset : %reportPossiblyNonexistentStringOffset%
841+ reportPossiblyNonexistentStringOffset : %featureToggles. reportPossiblyNonexistentStringOffset%
842842
843843 -
844844 class : PHPStan\Rules\ClassNameCheck
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ parametersSchema:
3232 skipCheckGenericClasses : listOf (string ()),
3333 stricterFunctionMap : bool ()
3434 reportPreciseLineForUnusedFunctionParameter : bool ()
35+ reportPossiblyNonexistentStringOffset : bool ()
3536 ])
3637 fileExtensions : listOf (string ())
3738 checkAdvancedIsset : bool ()
@@ -74,7 +75,6 @@ parametersSchema:
7475 reportAnyTypeWideningInVarTag : bool ()
7576 reportPossiblyNonexistentGeneralArrayOffset : bool ()
7677 reportPossiblyNonexistentConstantArrayOffset : bool ()
77- reportPossiblyNonexistentStringOffset : bool ()
7878 checkMissingOverrideMethodAttribute : bool ()
7979 parallel : structure ([
8080 jobSize : int (),
Original file line number Diff line number Diff line change @@ -832,7 +832,7 @@ public function testBug11946(): void
832832 53 ,
833833 ],
834834 [
835- "Offset int<-5, 5> might not exist on 'hi '. " ,
835+ "Offset int<-5, 5> might not exist on 'hia '. " ,
836836 56 ,
837837 ],
838838 ]);
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