-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
fix symfony/config deprecation #1153
Conversation
Co-Authored-By: Andreas Braun <[email protected]>
Changes look good, just waiting to see if travis-ci likes this version better than the previous one. Breakage is most likely unrelated, but I'd like to investigate the failure if it occurs. I'll be merging this once the build is stable. Thanks @jrushlow! |
@@ -91,7 +91,11 @@ private function addDbalSection(ArrayNodeDefinition $node) : void | |||
->end() | |||
->children() | |||
->scalarNode('class')->isRequired()->end() | |||
->booleanNode('commented')->setDeprecated()->end() | |||
->booleanNode('commented')->setDeprecated( | |||
'doctrine/doctrine-bundle', |
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.
With symfony/config
< 5.1 this change would now mean that the message displayed to the user would be doctrine/doctrine-bundle
as the only argument of setDeprecated()
used to be the message.
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.
hmm, would something along the lines of
$messageArray = $this-getMessage();
private func getMessage(): array
{
if config < 5.1 $message = [] else $message ['doctrine/bundle', 2.0, 'this is why'];
}
....->setDeprecated(...$messageArray)->end()
do the trick?
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.
Yes, I think so.
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.
i believe this is now taken care of. See my comment below...
@@ -91,7 +92,7 @@ private function addDbalSection(ArrayNodeDefinition $node) : void | |||
->end() | |||
->children() | |||
->scalarNode('class')->isRequired()->end() | |||
->booleanNode('commented')->setDeprecated()->end() | |||
->booleanNode('commented')->setDeprecated(...$this->getCommentedParamDeprecationMsg())->end() |
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.
if return value of $this->getCommentedParamDeprecationMsg()
is []
, I believe using ...
will cause ArgumentCountError
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.
fixed - for config versions before 5.1
, a message is provided. Attempted to return null
for < 5.1 but that triggered a TypeError
in an even earlier version before setDeprecated()
allowed ?string
0c0cefa
to
23e93be
Compare
@jrushlow thanks for the contribution! Merging this as the coverage build is also failing in master. travis-ci not reporting back its result is an issue they've been having that we're trying to work around separately. |
Starting in Symfony/Config 5.1, calling
NodeDefinition::setDeprecated()
with no arguments is deprecated. See symfony/symfony#35871This addresses the deprecation by providing the soon to be required parameters.