Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static methods defined as non-static #484

Closed
khooz opened this issue Dec 21, 2014 · 1 comment
Closed

Static methods defined as non-static #484

khooz opened this issue Dec 21, 2014 · 1 comment
Labels

Comments

@khooz
Copy link

khooz commented Dec 21, 2014

Hi!

This is actually not a bug issue but coding issue. Confide as a facade uses many functions that are defined non-static.but they are static by nature. As I understand, Facades are best implemented as static classes and any other non-static features should be addressed within the namespace\class convention. This matter can be easily fixed just by defining most of the functions and parameters used by the Facade as static.

It truly speeds up development as referencing and completion and other IDE features will be instantly available and static methods and attributes are accessed faster in runtime too (not significant though).

I would do that myself (and actually did it for my own project) but I hesitate to suggest contributing since I'm new to opensource community and don't know too much about its conventions.

Thanks for your fantastic work!

@Zizaco
Copy link
Owner

Zizaco commented Jan 31, 2015

Yeah. In fact, if we take best practices by the book than you should not be using facades but injecting the actual instances where you are gonna use then. But this is just the "laravel way" for beginners. Also, static methods are untestable in PHP, that`s why, (if you take automated tests seriously) you should never write static methods.

@Zizaco Zizaco closed this as completed Jan 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants