Page 1 of 1

Many "Use of unknown class" warnings - references not found

PostPosted: September 24th, 2018, 7:01 am
by info@dotcompanion.de
Hello,
I do a lot of Joomla extension and plugin development using VS 2017 and PHP tools.
The problem that makes development a pain is that PHP tools doesn't find many many references to the Joomla framework class. I always get the above warning "Use of unknown class" for almost all Joomla classes like:
  • JHtml
  • JRoute
  • JFactory
  • JControllerLegacy
  • and many more

The project includes the complete Joomla source tree with all files and folders. So there are no additional external references which I could include.
Why does PHP tools not find those classes and references?
I didn't have that problem with other PHP IDEs.

Right now PHP tools is almost useless for Joomla development.
Could you please have a look at this.
Thanks.

Re: Many "Use of unknown class" warnings - references not fo

PostPosted: September 24th, 2018, 8:52 am
by Jakub Misek
Hi,

Thanks for the feedback.

It seams all these Joomla classes are "aliased", actually not defined in the code, and PHP Tools does not handle that yet.

For other IDE's it is usually necessary to include a special PHP file that adds dummy declarations of these files (like this one https://github.com/Jensen-Technologies/ ... m.meta.php)

We'll definitely add better support for Joomla (and aliased classes in general) in future. For now I suggest to include the `.phpstorm.meta.php` file above into your project to satisfy the editor's warnings.

Thanks,

Re: Many "Use of unknown class" warnings - references not fo

PostPosted: September 24th, 2018, 11:38 am
by info@dotcompanion.de
Thank you very much!
This helped a lot.
After including the meta file with the alias information almost all the classes are recognized.

Nevertheless I hope you'll implement the alias feature in the future because otherise those dummy classes have to be maintained and updated potentially after each Joomla update.