-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Stop using deprecated defaultOption method #228
Conversation
c12e838
to
6ee5851
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just a couple of questions.
@@ -38,9 +38,8 @@ class GlobeCoordinateParser implements ValueParser { | |||
|
|||
public function __construct( ?ParserOptions $options = null ) { | |||
$this->options = $options ?: new ParserOptions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not:
$this->options = ($options ?: new ParserOptions())
->withDefaultOption(...)
->withDefaultOption(...);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also works, but I couldn't be bothered in this case
|
||
public function __construct( ?ParserOptions $options = null ) { | ||
$this->options = $options ?: new ParserOptions(); | ||
|
||
$this->options->defaultOption( ValueParser::OPT_LANG, 'en' ); | ||
$this->defaultOption( ValueParser::OPT_LANG, 'en' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for preferring the private defaultOption
method here to repeated calls to withDefaultOption
? Is it a wish to avoid repeated re-allocation of the options object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was the quickest fix
This fixes the build, because Psalm gets angry when you use deprecated methods.