-
-
Notifications
You must be signed in to change notification settings - Fork 947
Feature toggle for precise offsets in errors #11760
Copy link
Copy link
Closed
phpstan/phpstan-src
#3504Labels
Description
Feature request
The following code produces 2 errors that look the same:
$a=[];
echo $a['someLongKeyThatMightNotExist'];
echo $a['someLongKeyThatMightExist'];Offset 'someLongKeyThatMigh…' does not exist on array{}. offsetAccess.notFound
Offset 'someLongKeyThatMigh…' does not exist on array{}. offsetAccess.notFound
That also means that in the baseline, they show up as a single error that happens twice.
-
message: "#^Offset 'someLongKeyThatMigh…' does not exist on array\\{\\}\\.$#"
count: 2
path: src/MyFile.php
I understand that some values need to be truncated, but also for errors related to array offsets?
Would it be an idea to create a feature toggle for this? It can then be used in the offset related errors to toggle between value and precise.
Did PHPStan help you today? Did it make you happy in any way?
💙
Reactions are currently unavailable