phalcon/ide-stubs

Use phalcon with eval(a) or reflection, so the development environment does not throw error messages

jayjupdhig opened this issue · 7 comments

Hi there

My eclipse always says "The import Phalcon ... cannot be resolved" and "PhalconClass cannot be resolved to a type" and so on...

I think there is no other "solution" than to disable that kind of warnings, error messages, whatever. But the problem is that other classes, they are REALLY missing, will also not shown anymore.

And i also think it's COMPLETELY IMPOSSIBLE to avoid that problem - because phalcon has, as a php extension, no php classes they may be resolved.

So my idea: To use the eval() method or reflection to bypass that issue?

What do you think about? Is that a good idea or not? Maybe there are other (better?) solutions for it?

Thank you for your feedbacks.

Best regards,
Jan

You can you use the ide-stubs for this. You install it locally so your ide knows how to resolve the classes. https://github.com/phalcon/ide-stubs

OK thx. So i saw, the that ide-stubs are just a "skeleton" (sure, what else?), so i think when i add them to my source code folder the PHP code with phalcon does not work anymore? (Because of the empty things)

But i didn't tried it until now...

Regards, Jan

@martijintro it's not part of the autoload so it won't be used by your project. Give it a try using composer and let me know if this solves your problem. See this post as well. https://blog.phalcon.io/post/phalcon-ide-stubs-repository

I don't know how to do that in eclipse - most problems are already solved (more or less) by using reflection.

That is simple, does not need a lot of lines:

$loader = (new ReflectionClass("Phalcon\Loader"))->newInstance();

Thank you very much, will look about it!! :-)