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

Add withDefaultOption() to replace defaultOption() #59

Merged
merged 2 commits into from
Dec 6, 2022
Merged

Conversation

lucaswerkmeister
Copy link
Member

Passing the same mutable options instance around all over the place, with various parts of the code adding different defaults to it, is a recipe for confusion and bugs. Discourage it by introducing a new method that has cloning built into its interface.

Partially motivated by Construct parsers with a copy of ParserOptions.

This is pretty clearly a copy of FormatterOptionsTest: see

    diff <(sed 's/formatter/parser/g; s/Formatter/Parser/g;' tests/ValueFormatters/FormatterOptionsTest.php) tests/ValueParsers/ParserOptionsTest.php

Rename one variable that had been missed so far, and smooth out a
difference that was introduced in 814035c.
Passing the same mutable options instance around all over the place,
with various parts of the code adding different defaults to it, is a
recipe for confusion and bugs. Discourage it by introducing a new method
that has cloning built into its interface.
lucaswerkmeister added a commit that referenced this pull request Dec 6, 2022
The default of 1 (only HEAD, no parents) is not enough for Scrutinizer,
it seems. Problem witnessed in #59.
@lucaswerkmeister
Copy link
Member Author

CI should get fixed by #60.

@JeroenDeDauw JeroenDeDauw merged commit 7c54a89 into master Dec 6, 2022
@JeroenDeDauw JeroenDeDauw deleted the options branch December 6, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants