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

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

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

Postby info@dotcompanion.de » September 24th, 2018, 7:01 am

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.
info@dotcompanion.de
 
Posts: 4
Joined: September 17th, 2018, 6:13 pm

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

Postby Jakub Misek » September 24th, 2018, 8:52 am

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2081
Joined: January 4th, 2012, 2:42 pm
Location: Prague

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

Postby info@dotcompanion.de » September 24th, 2018, 11:38 am

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.
info@dotcompanion.de
 
Posts: 4
Joined: September 17th, 2018, 6:13 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 7 guests

cron

User Control Panel

Login

Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 5 minutes)
Most users ever online was 89 on October 15th, 2018, 4:06 pm

Users browsing this forum: No registered users and 7 guests
Phalanger