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 @@ -4,5 +4,4 @@ parameters:
44 checkParameterCastableToNumberFunctions : true
55 skipCheckGenericClasses! : []
66 stricterFunctionMap : true
7-
8- reportPossiblyNonexistentStringOffset : true
7+ reportPossiblyNonexistentStringOffset : true
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ parameters:
2525 checkParameterCastableToNumberFunctions : false
2626 skipCheckGenericClasses : []
2727 stricterFunctionMap : false
28+ reportPossiblyNonexistentStringOffset : false
2829 fileExtensions :
2930 - php
3031 checkAdvancedIsset : false
@@ -62,7 +63,6 @@ parameters:
6263 reportAnyTypeWideningInVarTag : false
6364 reportPossiblyNonexistentGeneralArrayOffset : false
6465 reportPossiblyNonexistentConstantArrayOffset : false
65- reportPossiblyNonexistentStringOffset : false
6666 checkMissingOverrideMethodAttribute : false
6767 mixinExcludeClasses : []
6868 scanFiles : []
@@ -837,7 +837,7 @@ services:
837837 reportMaybes : %reportMaybes%
838838 reportPossiblyNonexistentGeneralArrayOffset : %reportPossiblyNonexistentGeneralArrayOffset%
839839 reportPossiblyNonexistentConstantArrayOffset : %reportPossiblyNonexistentConstantArrayOffset%
840- reportPossiblyNonexistentStringOffset : %reportPossiblyNonexistentStringOffset%
840+ reportPossiblyNonexistentStringOffset : %featureToggles. reportPossiblyNonexistentStringOffset%
841841
842842 -
843843 class : PHPStan\Rules\ClassNameCheck
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ parametersSchema:
3131 checkParameterCastableToNumberFunctions : bool (),
3232 skipCheckGenericClasses : listOf (string ()),
3333 stricterFunctionMap : bool ()
34+ reportPossiblyNonexistentStringOffset : bool ()
3435 ])
3536 fileExtensions : listOf (string ())
3637 checkAdvancedIsset : bool ()
@@ -73,7 +74,6 @@ parametersSchema:
7374 reportAnyTypeWideningInVarTag : bool ()
7475 reportPossiblyNonexistentGeneralArrayOffset : bool ()
7576 reportPossiblyNonexistentConstantArrayOffset : bool ()
76- reportPossiblyNonexistentStringOffset : bool ()
7777 checkMissingOverrideMethodAttribute : bool ()
7878 parallel : structure ([
7979 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