Joomla JText etc. undefined method ::_
With Joomla! Framework enabled, the JText method references to the wrong Class, intead of referencing to classmap.php like most of them do, it references to restore_finalisation.php which JText is there an abstract class and misses some Methods. On inspectation, then PhpStorm references to the abstract class instead of the right classmap. Is there a way to handle this, in settings maybe? Or can i do something else to reference to the right library?
The Component i am writing works just fine, Joomla handles it correct.
Also the Classes JFolder, JFile are affected
I am working on PhpStorm 2019.3.1
Build #PS-193.5662.63, built on December 19, 2019
Also installed with composer
"joomla/coding-standards": "2.0.0-rc3"
请先登录再写评论。
It could be a rough workaround but did you try to exclude (Mark as excluded) directory with a wrong class?
The File is not in my project, it is an external library
i don't see where i could do this, this way
Hi Micha Zutter,
Did you find a solution to this? I use JText::_ a lot in my project, and I get tired of seeing the warnings on the `_` function. The code obviously works. My current workarounds are:
* Add /** @noinspection PhpUndefinedMethodInspection */ at the top of the PHP file after the opening tag. This is not preferred, as this blanket suppresses ALL undefined method calls - not ideal for obvious reasons
* Add /** @noinspection PhpUndefinedMethodInspection */ on the line above each JText::_() call. Again, this is not ideal, as this unnecessarily bloats the project files with PHPStorm-specific comments that don't make sense outside the application.
I really appreciate any help you can provide.
Hi,
There is a similar report on YouTrack:
https://youtrack.jetbrains.com/issue/WI-45309/Getting-Method-not-found-in-JText-in-Joomla-3.9.2-exclude-of-administratorcomponentscomjoomlaupdate-is-required
As a workaround, you may want to mark
administrator/components/com_joomlaupdatedirectory as Excluded (right-click > mark as > excluded). I have just tried it on a sample Joomla project and it seems to be working.