Add trait support
Posted: February 8th, 2017, 8:41 am
Mostly I found that support for traits is a little bit crippled.
[1] Autocomplete when adding trait to class does not populate with traits in the same namespace. You need to use full namespace ("\Drupal\fdf\MyCustomTrait" instead of "MyCustomTrait" directly).
[2] Autocomplete when adding traits will let you use anything, including interfaces and classes. It should only populate with traits and show error when "using" inside a class is pointing to something that is not a trait.
[3] Methods "inherited" by a class through a trait are not seen by Intellisense. I had to resort to creating stub interfaces for Intellisense to pick the methods in the traits.
It would be great to see support for traits improved.
[1] Autocomplete when adding trait to class does not populate with traits in the same namespace. You need to use full namespace ("\Drupal\fdf\MyCustomTrait" instead of "MyCustomTrait" directly).
[2] Autocomplete when adding traits will let you use anything, including interfaces and classes. It should only populate with traits and show error when "using" inside a class is pointing to something that is not a trait.
[3] Methods "inherited" by a class through a trait are not seen by Intellisense. I had to resort to creating stub interfaces for Intellisense to pick the methods in the traits.
It would be great to see support for traits improved.