Skip to content

Commit

Permalink
use featureToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Nov 17, 2024
1 parent c449bc7 commit a3b8bdf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions conf/bleedingEdge.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ parameters:
bleedingEdge: true
skipCheckGenericClasses!: []
stricterFunctionMap: true

reportPossiblyNonexistentStringOffset: true
reportPossiblyNonexistentStringOffset: true
4 changes: 2 additions & 2 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parameters:
bleedingEdge: false
skipCheckGenericClasses: []
stricterFunctionMap: false
reportPossiblyNonexistentStringOffset: false
fileExtensions:
- php
checkAdvancedIsset: false
Expand Down Expand Up @@ -60,7 +61,6 @@ parameters:
reportAnyTypeWideningInVarTag: false
reportPossiblyNonexistentGeneralArrayOffset: false
reportPossiblyNonexistentConstantArrayOffset: false
reportPossiblyNonexistentStringOffset: false
checkMissingOverrideMethodAttribute: false
mixinExcludeClasses: []
scanFiles: []
Expand Down Expand Up @@ -835,7 +835,7 @@ services:
reportMaybes: %reportMaybes%
reportPossiblyNonexistentGeneralArrayOffset: %reportPossiblyNonexistentGeneralArrayOffset%
reportPossiblyNonexistentConstantArrayOffset: %reportPossiblyNonexistentConstantArrayOffset%
reportPossiblyNonexistentStringOffset: %reportPossiblyNonexistentStringOffset%
reportPossiblyNonexistentStringOffset: %featureToggles.reportPossiblyNonexistentStringOffset%

-
class: PHPStan\Rules\ClassNameCheck
Expand Down
2 changes: 1 addition & 1 deletion conf/parametersSchema.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ parametersSchema:
bleedingEdge: bool(),
skipCheckGenericClasses: listOf(string()),
stricterFunctionMap: bool()
reportPossiblyNonexistentStringOffset: bool()
])
fileExtensions: listOf(string())
checkAdvancedIsset: bool()
Expand Down Expand Up @@ -71,7 +72,6 @@ parametersSchema:
reportAnyTypeWideningInVarTag: bool()
reportPossiblyNonexistentGeneralArrayOffset: bool()
reportPossiblyNonexistentConstantArrayOffset: bool()
reportPossiblyNonexistentStringOffset: bool()
checkMissingOverrideMethodAttribute: bool()
parallel: structure([
jobSize: int(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public function testBug11946(): void
53,
],
[
"Offset int<-5, 5> might not exist on 'hi'.",
"Offset int<-5, 5> might not exist on 'hia'.",
56,
],
]);
Expand Down
7 changes: 5 additions & 2 deletions tests/PHPStan/Rules/Arrays/data/bug-11946.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function maybeNonExistentStringOffset(
string $nonEmpty,
string $nonFalsy,
string $lowerCase,
int $maybeWrong
int $maybeWrong, int $oneToTwo
)
{
echo $s[$maybeWrong];
Expand All @@ -52,7 +52,10 @@ public function maybeNonExistentStringOffset(
echo $nonFalsy[$maybeWrong];
echo $lowerCase[$maybeWrong];

$s = 'hi';
$s = 'hia';
echo $s[$maybeWrong];
if ($maybeWrong >= 1 && $maybeWrong < 3) {
echo $s[$maybeWrong];
}
}
}

0 comments on commit a3b8bdf

Please sign in to comment.