Skip to content

[Dotenv] Mention the overrideExistingVars parameter of DotEnv #19082

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

Merged

Conversation

alexandre-daubois
Copy link
Member

Related to symfony/symfony#52090

I think this is a good place to mention it, as the DotEnv component doesn't have a proper documentation page

@carsonbot carsonbot added this to the 5.4 milestone Oct 24, 2023
@carsonbot carsonbot changed the title [DotEnv] Mention the overrideExistingVars parameter of DotEnv [Dotenv] Mention the overrideExistingVars parameter of DotEnv Oct 24, 2023
use Symfony\Component\Dotenv\Dotenv;

$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/.env', null, 'dev', ['test'], true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use named arguments here and only add the required one + the overrideExistingVars parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but 5.4 minimal req is PHP 7.2. Shouldn't the example be compatible with the lowest possible PHP version ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh indeed, but we can do it after upmerge

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll provide the PR 🙂

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment

@OskarStark
Copy link
Contributor

cc @oleg-andreyev

@OskarStark
Copy link
Contributor

Open for a PR to adjust the PHPDoc in the code repo, like proposed by stof?

@alexandre-daubois
Copy link
Member Author

Here you go 🙂

@javiereguiluz javiereguiluz merged commit 3f33d31 into symfony:5.4 Oct 25, 2023
@javiereguiluz
Copy link
Member

Nice contribution as always. Thanks Alex!

@alexandre-daubois alexandre-daubois deleted the loadenv-override-existing-vars branch October 25, 2023 11:21
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Oct 26, 2023
…re-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

[Dotenv] Add PHPDoc for `$overrideExistingVars`

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Following symfony/symfony-docs#19082 (comment)

Commits
-------

218a4ac [Dotent] Add PHPDoc for `$overrideExistingVars`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants