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

functions.php a bad idea #65

Closed
GrahamCampbell opened this issue Jul 1, 2020 · 2 comments
Closed

functions.php a bad idea #65

GrahamCampbell opened this issue Jul 1, 2020 · 2 comments

Comments

@GrahamCampbell
Copy link
Contributor

https://github.com/opis/closure/blob/4.x/composer.json#L33 loads a functions.php file. Note that this will lead to a fatal error if someone globally installs opis and also locally installs it. I'd instead recommend making the init function a static class method. PHP's autoloader was built to load classes, not functions, basically.

NB Other libraries like illuminate/support get around this by conditionally defining their functions, but this would not be a good solution for opis, since it really matters you get the correct function. This also really matters for Guzzle, which is why we moved to static class methods after we got bitten by this: guzzle/guzzle#2511, guzzle/guzzle#2548, guzzle/guzzle#2546.

@sorinsarca
Copy link
Member

I've just removed the functions.php file, please check the readme file https://github.com/opis/closure/blob/4.x/README.md

@GrahamCampbell
Copy link
Contributor Author

Perfect. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants