We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

IDE Intellisense for Method Chaining (PhpStorm)

For straight phalcon calls, the use of the stubs for IDE's works fine. I'm using PhpStorm, in which I have also installed the Phalcon autocomplete plugin. For a method chain of Model::query()->...->execute(), however, the result type is not recognized. In the case below:

edited Aug '18

You need to add phpdocs on planUnits or planUnit, no other way around this. When using ::query phalcon uses Criteria class which returns just ResultsetInerface https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/criteria.zep.

The only way around this could be phpstorm extension which could detect on what ::query() was called and provide correct return type for execute method. As far as i know otherwise using phpdocc there is no way to return correct type for execute method other then of course overwriting ::query method and create seperated criteria class for each model, but i guess you won't to do this.