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

Scalar types and environement variables #751

Open
n00dl3 opened this issue Dec 11, 2020 · 0 comments
Open

Scalar types and environement variables #751

n00dl3 opened this issue Dec 11, 2020 · 0 comments

Comments

@n00dl3
Copy link

n00dl3 commented Dec 11, 2020

Hi, and first thank you for this nice piece of software.

I read the suggestion in #744 and I agree that automatic conversion by default is not the way to go.
But on the other hand, the lack of conversion from environment variables to php scalar types makes the DI\env helper mostly unusable (except for strings) if you are using strict types.

I think one way to go might be to add a third optional parameter to DI\env specifying the type of variable you expect like DI\env("MY_VARIABLE",0,ENV_TYPE_INT) or DI\env("MY_VARIABLE",0,ENV_TYPE_INT), that third parameter would default to string, allowing backward compatibility.

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

1 participant