-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Config] Add Node::getDeprecationMessage() with full message
#61799
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
Conversation
| /** | ||
| * @param string $node The configuration node name | ||
| * @param string $path The path of the node | ||
| * @return array{package: string, version: string, message: string} |
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.
We can also update the returned message to prepend the package and version. But this could duplicate the "since ..." prefix if its prepended somewhere outside. This method is not used in Symfony outside of the Config component.
144f752 to
68f8a4a
Compare
68f8a4a to
ebb4d65
Compare
|
Thank you @GromNaN. |
|
|
||
| $message = strtr($this->deprecation['message'], ['%node%' => $this->getName(), '%path%' => ($parent ?? $this->parent ?? $this)->getPath()]); | ||
| if ($this->deprecation['package'] || $this->deprecation['version']) { | ||
| $message = \sprintf('Since %s %s: ', $this->deprecation['package'], $this->deprecation['version']).$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.
Would make more sense.
| $message = \sprintf('Since %s %s: ', $this->deprecation['package'], $this->deprecation['version']).$message; | |
| $message = \sprintf('Since %s %s: %s', $this->deprecation['package'], $this->deprecation['version'], $message); |
Avoids repetition of identical code in Yaml and XML dumpers, PHP config generator, and the upcoming JSON schema generator.