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
Currently PHP works with typing as everyone knows:
<?phpfunctionsum(int$a, int$b) : int {
return$a + $b;
}
What I would like to know is if it is possible to type an array with the type of a class for example (or another interface, enum, etc.) as this would help the IDE to recognize the methods and properties of the class.
This idea has come up many times before, such as in #15795 and #14384 and #13398, as well as through concepts like generics (array<T>) and pattern matching ($var is string[]). I think the most recent conversation on the internals mailing list was this one (also here?).
The summary is that support for typed arrays has some potential problems with its implementation, but there are also some competing ideas that would provide the same sort of functionality in a different way.
Description
Currently PHP works with typing as everyone knows:
What I would like to know is if it is possible to type an array with the type of a class for example (or another interface, enum, etc.) as this would help the IDE to recognize the methods and properties of the class.
An example would be:
So when writing the code, the IDE would automatically complete the methods and properties of the Person class (name and age)
I don't know if the implementation of this is already under discussion or not, but I would like to leave this suggestion here for the community.
The text was updated successfully, but these errors were encountered: