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

PHPStorm intellisense/auto complete on shared DI

Hi guys.

I am using some composer packages in my project and would love to have intellisense/auto complete on shared DI. it's registerd in the bootstrap with $di->setShared().

and then used in the controller with $this->"The shared name".

I have added IDE STUBS from the dev-tools to my IDE but that isn't enough. composer is also added to my IDE.



7.9k

Hi,

Service locator is bad practice anyway. Also it will not support code completion, you have pass dependency manually in your class either using constructor or setter.

I recommend you read this article https://martinfowler.com/articles/injection.html