Page 1 of 1

intellisense for objects in foreach loop

PostPosted: September 20th, 2012, 5:41 pm
by seifist
I have the commercial version of php tools for visual studio 2012 and have been using it for the last few weeks with much satisfaction.

One point of irritation, however, is that the intellisense doesn't work when I am using a foreach loop to loop through an array of objects.

Lets say I create a custom object called MyObject. Then in another object I create an array as a property. If I populate said array with a series of MyObjects, when I try to use a foreach loop to loop through the objects in that array, the intellisense treats each item I am looping through as an untyped variable. Therefore, intellisense doesn't work for the properties and functions of MyObject.

Are there any settings I can change to fix this? If not, is this a known issue that will be repaired in future versions?

Re: intellisense for objects in foreach loop

PostPosted: September 20th, 2012, 6:04 pm
by Jakub Misek
Hi,

Thank You for your feedback! IntelliSense of array items, together with completing array keys, is currently one of our planned high-priority features. We will do our best to release it in one of the next updates.

I'll mail You once this feature will be released. Feel free to give us note about anything else You would like to see in next version.

Regards,

Re: intellisense for objects in foreach loop

PostPosted: September 25th, 2012, 6:24 pm
by seifist
Thanks Jakub, I look forward to the update.

Re: intellisense for objects in foreach loop

PostPosted: October 11th, 2012, 9:30 am
by BladeMF
I might add this - when implementing "foreach" intellisense, search for implementation of Iterator interface on the collection (object being looped, if it not an array) and then take the return value from the PHPDoc on the Current() function.

Re: intellisense for objects in foreach loop

PostPosted: October 11th, 2012, 12:41 pm
by Jakub Misek
BladeMF wrote:I might add this - when implementing "foreach" intellisense, search for implementation of Iterator interface on the collection (object being looped, if it not an array) and then take the return value from the PHPDoc on the Current() function.

Great idea! We will surely add this onto our todo list.