Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TwigComponent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Add option `profiler.collect_components` to control component data collection
in the profiler (enabled in debug mode by default)
- Add support for using directory name as component name for anonymous components

- Deprecate using `null` to add an attribute. Starting in `3.0`, passing `true` explicitly sets the attribute, while passing `false` or `null` omits it.
## 2.30

- Ensure compatibility with PHP 8.5
Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/ComponentAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __toString(): string
}

if (null === $value) {
trigger_deprecation('symfony/ux-twig-component', '2.8.0', 'Passing "null" as an attribute value is deprecated and will throw an exception in 3.0.');
trigger_deprecation('symfony/ux-twig-component', '2.32.0', 'Passing null as value to set an attribute is deprecated, pass true instead. In 3.0, the null value will remove the attribute.', $key);
$value = true;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we should precise the key... I mean maybe we should not suggest passing null is deprecated for that attribute only.

"To keep the current result, pass true instead."

I think with the various changes we plan, we should avoid using "current" / "previous" / "next" or maintaining (or reading) the docs will become quickly really hard.

What about something like "Use true to add the attribute, null or false to remove it"

Copy link
Author

Choose a reason for hiding this comment

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

I will try to reword that.

My initial idea was that it might make it easier for users to understand which attribute to search for. But I also realized that people might be collecting and grouping deprecation messages by type, and so having a different message for each attribute might not be helpful to them either.

Also, for example the XmlFileReader deprecated in Symfony 7.4 only says XML is deprecated but does not give the file name. So, omitting the attribute name will be in line with that.

Copy link
Author

@mpdude mpdude Jan 20, 2026

Choose a reason for hiding this comment

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

Now it's

Passing null as value to set an attribute is deprecated, pass true instead. In 3.0, the null value will remove the attribute.

}

Expand Down
Loading