-
Notifications
You must be signed in to change notification settings - Fork 889
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
Conflict with env function #1647
Comments
We don't currently create phar files. I'm not too familiar with the tooling to do so either, perhaps another contributor is. |
The same trick might also work here: #1401 (comment) |
Yes and no I'm using The library does not expose that function by default (it is not autoloaded by composer), you have to run The only workaround is to don't use the Anyway, I've started to using this library before it was converted to a cake component and would like it to remain a standalone framework-agnostic tool, so IMO, polluting the global with these functions is not a good idea. Global functions should be defined/loaded and used by final users, but not by dependencies. Maybe cake could expose its funcions under its own namespace, or using a class with static methods. |
@markstory Any way we can do this? |
The env() function in Cake is conditionally defined. If your application defines the function first the Cake one won't be created. Not autoloading the env() function entirely could be possible, but runs a high risk of breaking compatibility unless we can come up with a way to ensure env() exists everywhere but in phinx's usage. |
We should add a docs example how to load custom one before the core. |
A library that has some helper functions but pollutes the global namespace is really not very nice. Move the global methods to the Cake specific namespace, and heavily document a polyfiller project that reinstates the global pollution with a strong suggestion that the consumer's code should be upgraded to use the Cake specific namespace if they want to continue using the global function. I'm unsure if we should be using a static class, as there is a small semantic difference between a static method and a namespaced class (so small I can hardly see it). This is one of my biggest gripes with another well known and popular framework that starts with L. In short why does ANY framework think it should be able to pollute the global namespace. |
I just with PHP had function autoloading |
I use psysh REPL library which includes |
Hi.
My site stopped working because I have a
env
function to return environment variables and I just realized this library use CakePHP, that defines anotherenv
function before, so the site was using the cake's function that have a different behaviour.Is there any way to have phinx installed without having these functions defined by default? (Maybe using a phar file or something like that).
Thanks!
The text was updated successfully, but these errors were encountered: