Skip to content

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Sep 20, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

Avoids repetition of identical code in Yaml and XML dumpers, PHP config generator, and the upcoming JSON schema generator.

/**
* @param string $node The configuration node name
* @param string $path The path of the node
* @return array{package: string, version: string, message: string}
Copy link
Member Author

@GromNaN GromNaN Sep 20, 2025

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.

@fabpot
Copy link
Member

fabpot commented Sep 22, 2025

Thank you @GromNaN.

@fabpot fabpot merged commit 68487bf into symfony:7.4 Sep 22, 2025
10 of 12 checks passed
@GromNaN GromNaN deleted the node-dep-mess branch September 22, 2025 05:48

$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;
Copy link
Member Author

Choose a reason for hiding this comment

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

Would make more sense.

Suggested change
$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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants