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

Added small section about default values #11956

Merged
merged 1 commit into from
Aug 6, 2019
Merged

Conversation

j92
Copy link
Contributor

@j92 j92 commented Jul 13, 2019

Added a short description and a code sample of how to use default values when referenced variables are not set. The feature PR is symfony/symfony#31546.

@wouterj wouterj added this to the next milestone Jul 18, 2019
@wouterj wouterj added the Waiting Code Merge Docs for features pending to be merged label Jul 18, 2019
symfony-splitter pushed a commit to symfony/dotenv that referenced this pull request Aug 6, 2019
… not set (j92)

This PR was squashed before being merged into the 4.4 branch (closes #31546).

Discussion
----------

[Dotenv] Use default value when referenced variable is not set

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#11956 <!-- required for new features -->

In bash you have the option to define a default variable like this:
```bash
FOO=${VARIABLE:-default}
```

When VARIABLE is not set
```bash
FOO=${VARIABLE:-default} #FOO=default
```

When VARIABLE is set:
```bash
VARIABLE=test
FOO=${VARIABLE:-default} #FOO=test
```

If others find this also a good idea, I will write documentation and add the Doc PR. But first I would like some feedback to check if anyone agrees with this feature.

Commits
-------

790dbad149 [Dotenv] Use default value when referenced variable is not set
xabbuh added a commit to symfony/symfony that referenced this pull request Aug 6, 2019
… not set (j92)

This PR was squashed before being merged into the 4.4 branch (closes #31546).

Discussion
----------

[Dotenv] Use default value when referenced variable is not set

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#11956 <!-- required for new features -->

In bash you have the option to define a default variable like this:
```bash
FOO=${VARIABLE:-default}
```

When VARIABLE is not set
```bash
FOO=${VARIABLE:-default} #FOO=default
```

When VARIABLE is set:
```bash
VARIABLE=test
FOO=${VARIABLE:-default} #FOO=test
```

If others find this also a good idea, I will write documentation and add the Doc PR. But first I would like some feedback to check if anyone agrees with this feature.

Commits
-------

790dbad [Dotenv] Use default value when referenced variable is not set
@xabbuh xabbuh added Dotenv and removed Waiting Code Merge Docs for features pending to be merged labels Aug 6, 2019
@xabbuh xabbuh modified the milestones: next, 4.4 Aug 6, 2019
@xabbuh
Copy link
Member

xabbuh commented Aug 6, 2019

@j92 Thank you for implementing this feature and writing the docs for it. Can you rebase here now that the code has been merged? :)

@j92
Copy link
Contributor Author

j92 commented Aug 6, 2019

@xabbuh Done and thanks!

@OskarStark
Copy link
Contributor

Thank you, I added a versionadded directive while merging.

@OskarStark OskarStark merged commit 1848e00 into symfony:4.4 Aug 6, 2019
OskarStark added a commit that referenced this pull request Aug 6, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

Added small section about default values

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/roadmap for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `master` for features of unreleased versions).

-->

Added a short description and a code sample of how to use default values when referenced variables are not set. The feature PR is symfony/symfony#31546.

Commits
-------

1848e00 Added small section about default values
OskarStark added a commit that referenced this pull request Aug 6, 2019
OskarStark added a commit that referenced this pull request Aug 6, 2019
* 4.4:
  Add missing versionadded directive. refs #11956
  Added small section about default values
OskarStark added a commit that referenced this pull request Aug 6, 2019
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.

6 participants