enriquepiatti / Magicento

PHPStorm plugin for Magento developers
115 stars 35 forks source link

[Magento1] Some getters are not found #276

Open thomaszbz opened 6 years ago

thomaszbz commented 6 years ago

I'm using Magicento 3.1.4, PhpStorm 2017.2.4, Magento 1.9.3

I have PHP execution in place:

auswahl_419_2

Magicento then finds some of the getters (e.g. getAdditionalData):

auswahl_419_2

Some other getters are not found (e.g. getHasChildren):

auswahl_422

getHasChildren also is not part of the drop-down list when pressing CTRL + SPACE.

A fix should let getHasChildren be part of the drop-down list and in the code it should have white background (instead of orange background).

enriquepiatti commented 6 years ago

That's because is set dynamically on the code, is not a real attribute from the database. The error here is more from Magento team, they should add that method with PHPDocs on the class.

public function addChild($child)
{
    $this->setHasChildren(true);
    $this->_children[] = $child;
    return $this;
}

I guess we could try parsing all the files and searching for dynamic assignation like this one, but could be a bit slow and not always guaranteed, PHP and Magento are too dynamic, I guess is not possible to fully trust on things like this.