phptools-docs
phptools-docs copied to clipboard
OpenCart / Go to Definition
Hello, @jakubmisek, I am looking for a solution for Go to Definition specifically for OpenCart framework.
When I use F12, I can't go to definition which is expected. Because of this design, I need to browse through lots of files or use search in order to find the symbol.
Can you add a feature in one of the upcoming releases so we can use F12 to go directly to the symbol?
May I ask you to mouse-hover over the model_sale_order? It seems the editor does not know the type of it.
Thank you
Nothing shows when I hover over load, model(), model_sale_order, session, data['user_token'](the one on the right side), getTotalOrders(), language(). No definition found for them either.
Ok, that explains it - I'll try the OpenCart framework again and make some tests for it.
Thank you
hello @jakubmisek, do we have any update on this matter?
Thank you for reminding me @cagatay117 ,
The ->load is a property handled in the magic __get() method. Therefore, we have no way of understanding its type or even if it exists.
At this point, the authors of OpenCart should add additional PHPDoc annotation for the IDE to work properly. I was looking for some OpenCart IDE stubs but without luck so far.
You can do it by yourself - if you create a file anywhere in the project (for example \.ide\stubs.php):
<?php
/**
* @property Loader $load
*/
interface IDashboardMixin {}
and above the class Controller (I don't know OpenCart, so I'm just guessing where the load property should be present), add @mixin IDashboardMixin:
/**
* @mixin IDashboardMixin
*/
class Controller ...
from now on, $this->load will be treated as instance of Loader .