You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed something similar, so I didn't want to create another issue since it's perhaps related. In this case we have methods that return a return type that results in an integer keyed array of another object (return type defined as \SilverStripe\ORM\DataList|\****\Model\ResilienceTool\ResilienceQuestion[]).
This results in intelephense showing:
Which should be accurate, both shuffle() and limit() have a return type of static<T>:
However in the foreach loop it's seeing int as the type of the $question variable:
If I add a variable to place the key in foreach ($questions as $key => $question) the $key is interpreted by intelephense as a type mixed and question is still int.
Edit: In looking again worth noting that hovering $questions results in a type of \SilverStripe\ORM\DataList<int>, even removing the call to limit results in the same. So in my case it appears to be getting lost earlier than the loop. However removing shuffle() and limit() still does result in the loop showing a type of int for $question.
Describe the bug
When using foreach the "go to definion" of type variable's value is lost
To Reproduce
Expected behavior
Go to definiton works normally
Screenshots
Platform and version
Windows 11, Intelephense v1.12.6
The text was updated successfully, but these errors were encountered: