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

Instance methods? #15

Closed
pmjones opened this issue Jan 27, 2014 · 5 comments
Closed

Instance methods? #15

pmjones opened this issue Jan 27, 2014 · 5 comments

Comments

@pmjones
Copy link

pmjones commented Jan 27, 2014

Another nice-to-have would be instance methods instead of, or in addition to, static methods. Some of us start twitching when we see :: paired with $ or ().

@vlucas
Copy link
Owner

vlucas commented Jan 27, 2014

That is understandable, and I am generally opposed to static methods myself, but in this case I thought an instance might be overkill. The class started with a single method - to load the file, and now has only two methods and will be at most 2 lines of code. Additionally, environment variables are global state, so in this case a class instance didn't really serve any real purpose.

@stanlemon
Copy link
Contributor

The instance methods could be wrapped by the static methods, thus maintaining the api but also allowing for decent mocking in a project without having to resort to an alias mock. I think that's probably the most compelling reason to reconsider the statics.

@ghost
Copy link

ghost commented Mar 1, 2015

is this fixed sufficiently in phpdotenv 2.x ?

@vlucas
Copy link
Owner

vlucas commented Mar 2, 2015

Yes, this is in v2.x and working well. Currently pending full release very soon.

@vlucas
Copy link
Owner

vlucas commented May 30, 2015

This is now in v2.0.0: https://github.com/vlucas/phpdotenv/releases/tag/v2.0.0

@vlucas vlucas closed this as completed May 30, 2015
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

3 participants