Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Dotenv] Make load() variadic#23242

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromchalasr:dotenv4-variadic
Jun 21, 2017
Merged

Conversation

@chalasr
Copy link
Member

QA
Branch?4.0
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsDotenv.php#L50
LicenseMIT
Doc PRn/a

* @throws PathException when a file does not exist or is not readable
*/
publicfunctionload($path/*,...$paths*/)
publicfunctionload(...$paths)
Copy link
Member

Choose a reason for hiding this comment

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

I would keep the$path, ...$paths signature as it conveys the fact that at least one path is required.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

got it, fixed

@chalasrchalasrforce-pushed thedotenv4-variadic branch 2 times, most recently fromf962fec to96081cdCompareJune 20, 2017 21:13
@chalasr
Copy link
MemberAuthor

chalasr commentedJun 20, 2017
edited
Loading

Should we update the signature from($path, ...$paths) to(string $path, string ...$paths) (Dotenv is final)?

@ogizanagiogizanagi mentioned this pull requestJun 21, 2017
file_put_contents($path1,'FOO=BAR');
file_put_contents($path2,'BAR=BAZ');

(newDotEnv())->load($path1,$path2);
Copy link
Member

Choose a reason for hiding this comment

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

The test loading multiple paths should actually be added in 3.3

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

* @throws PathException when a file does not exist or is not readable
*/
publicfunctionload($path/*, ...$paths*/)
publicfunctionload($path, ...$paths)

Choose a reason for hiding this comment

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

Why can't we changeload($path, ...$paths) toload(...$paths) in Symfony 4?

Copy link
MemberAuthor

@chalasrchalasrJun 21, 2017
edited
Loading

Choose a reason for hiding this comment

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

@javiereguiluz see#23242 (comment).
Imho, we could have kept only... $paths, maybe throwing if$paths is empty, but having both in the signature looks a bit weird

sstok and GromNaN reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

well, havingload($path, ...$paths) means that the signature itself tells people that at least 1 argument is required (and IDEs know it too then).load(...$paths) allows 0 arguments

jvasseur, ogizanagi, yceruto, and chalasr reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

imo it's not that bad if the ...$paths is empty. No file loaded, no env variable created

Copy link
Member

Choose a reason for hiding this comment

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

@Taluu writing$dotenv->load() in your code which is always a no-op because you misused it is a bad DX (and this is the experience talking: it was the initial API of the component when merging it in Symfony)

Copy link
MemberAuthor

@chalasrchalasrJun 21, 2017
edited
Loading

Choose a reason for hiding this comment

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

Indeed, can sound like callingload() will automagically look for some.env but nothing happens.

fabpot added a commit that referenced this pull requestJun 21, 2017
This PR was merged into the 3.3 branch.Discussion----------[Dotenv] Test load() with multiple paths| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------dabecde [Dotenv] Test load() with multiple paths
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

Can be rebase now that the test has been merged in 3.3.

fabpot added a commit that referenced this pull requestJun 21, 2017
This PR was merged into the 4.0-dev branch.Discussion----------[DI] Uncomment code| Q             | A| ------------- | ---| Branch?       | master <!-- see comment below -->| Bug fix?      | no| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->| BC breaks?    | no| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->| Tests pass?   | yes| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | N/AI was about fixing all [other occurrences of commented code and `func_get/num_arg(s)`](https://github.com/symfony/symfony/search?utf8=%E2%9C%93&q=func_num_args&type=) as BC layer usages at once, but the following PRs will already cover it:- HttpFoundation:#22863- Serializer:#23241- Process:#22836- DotEnv:#23242So it only remains DI ones.Commits-------03f33b5 [DI] Uncomment code
@chalasr
Copy link
MemberAuthor

rebased, not added string typehints, let me know if I should.

@fabpot
Copy link
Member

For typehints, we should have a discussion about how we want to introduce them.

@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commit408a33e intosymfony:masterJun 21, 2017
fabpot added a commit that referenced this pull requestJun 21, 2017
This PR was merged into the 4.0-dev branch.Discussion----------[Dotenv] Make load() variadic| Q             | A| ------------- | ---| Branch?       | 4.0| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | [Dotenv.php#L50](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Dotenv/Dotenv.php#L50)| License       | MIT| Doc PR        | n/aCommits-------408a33e [Dotenv] Make load() variadic
@chalasrchalasr deleted the dotenv4-variadic branchJune 21, 2017 14:21
@chalasr
Copy link
MemberAuthor

chalasr commentedJun 21, 2017
edited
Loading

@fabpot Actually, passing a value that can't be casted as string to this method would break. Given the class is final, I think adding them would be safe.

@stof
Copy link
Member

@chalasr passign a non-castable valuealready breaks (inside the function). So I'm totally +1 for adding the typehint here (we cannot add them on non-final non-private methods due to BC, but we can here)

@chalasr
Copy link
MemberAuthor

@stof see#23262

fabpot added a commit that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b [Yaml] use scalar type hints where possible6ce70e4 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/console that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/routing that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/http-kernel that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b [Yaml] use scalar type hints where possible6ce70e4 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/security-http that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/security that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/lock that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
symfony-splitter pushed a commit to symfony/property-access that referenced this pull requestSep 3, 2017
This PR was merged into the 4.0-dev branch.Discussion----------Add scalar typehints/return types| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no (final, already breaks if doc not respected)| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony/symfony#23242 (comment)| License       | MIT| Doc PR        | n/aCommits-------7b1715b078 [Yaml] use scalar type hints where possible6ce70e4bf9 Add scalar typehints/return types on final/internal/private code
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@TaluuTaluuTaluu left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@chalasr@fabpot@stof@javiereguiluz@Taluu@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp