Skip to content

[Config] Soft BC break in ->setDeprecated() #37284

@apfelbox

Description

@apfelbox

Symfony version(s) affected: 5.1.x

Description
There is a soft BC break in the new features for ->setDeprecated() in the config builder.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Config/Definition/BaseNode.php#L208

How to reproduce

-    public function setDeprecated(?string $message)
+    public function setDeprecated(?string $package/*, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.' */)

Adding the parameters at the front makes it impossible to both support 5.1+ and <5.1 as a bundle.

If you use the intended 5.1+ way:

->setDeprecated("my/bundle", "1.0", "this node is deprecated, do sth else")
  • in 5.1+ we will show the message "this node is deprecated, do sth else"
  • in <5.1 we will show the message "my/bundle"

Is there a (non-hacky) way to have the real message in both versions?

Possible Solution
No idea. Avoiding a second BC break would be great, but the current version is rather unhelpful for lower symfony versions -- that might warrant a second break?

Additional context

This is a separate ticket, to get visibility on this issue from this comment: #35871 (comment)

/cc @nicolas-grekas @atailouloute as you authored / merged this. wdyt?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions