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

Out-of-date IDE stubs or something else?

In PhpStorm, with the 2.0.9 IDE stubs from Phalcon Developer Tools, I am seeing this:

Unresolved symbols. (that code is straight up from the tutorials)

If I navigate to the definition of executeQuery, I see this:

Shouldn't the return interface be Phalcon\Mvc\Model\Query\StatusInterface?

I started using Phalcon yesterday, so I may be doing something wrong. I would like to know what.

Do the stubs need to be fixed? How do I do that?



484

I ran:

php gen-stubs.php

with CPHALCON_DIR pointing to the 2.0.10 code base.

According to those new stubs, $app->modelManager->executeQuery is now a function returing void. So, still no Status instance is returned according to those new stubs.

Maybe the tutorial is out-of-date?



484

My conclusion is that the stubs generated by the script can't possibly do the job. So, I turned off all inspections in the Undefined category in PhpStorm.

executeQuery should return a QueryInterface, because you can pass in arbitraty SQL statements, so it's impossible to know the returned model class beforehand.

Also, devtools stubs are generated from zephir source files automatically, don't expect them to be flawless. Model::getMessages() for example has a bad return type (should be MessageInterface[]).

If you want to fix them, GitHub pull requests are always welcome. I'd suggest you run another round with the ORM docs, because it seems to me there are conceptually flawed lines in your code.