Skip to content

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Oct 16, 2025

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

@carsonbot carsonbot added this to the 7.4 milestone Oct 16, 2025
@carsonbot carsonbot changed the title [Config] Deprecate setting a default value to a node that is required [Config] Deprecate setting a default value to a node that is required Oct 16, 2025
@GromNaN GromNaN force-pushed the config-default-required branch 2 times, most recently from 3afbdb8 to 5cef122 Compare October 16, 2025 17:23

public function testUnknownPackageThrowsException()
{
$node = new ArrayNodeDefinition('node');
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving expectException just before the call that produces it to be more specific.

Comment on lines +111 to +115
yield [ArrayNodeDefinition::class, []];
yield [ScalarNodeDefinition::class, null];
yield [BooleanNodeDefinition::class, false];
yield [StringNodeDefinition::class, 'default'];
yield [VariableNodeDefinition::class, 'default'];
Copy link
Member Author

Choose a reason for hiding this comment

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

Testing various child classes as they could have different behaviors.

@GromNaN GromNaN force-pushed the config-default-required branch from 5cef122 to e3e3c1c Compare October 16, 2025 19:00
@GromNaN GromNaN requested a review from chalasr as a code owner October 16, 2025 19:00
@GromNaN GromNaN force-pushed the config-default-required branch 2 times, most recently from 9549b89 to e19d3ed Compare October 16, 2025 19:08
@GromNaN GromNaN force-pushed the config-default-required branch from e19d3ed to 8a1bb6d Compare October 17, 2025 11:46
@GromNaN GromNaN force-pushed the config-default-required branch from 8a1bb6d to 5a47df9 Compare October 17, 2025 11:53
@GromNaN
Copy link
Member Author

GromNaN commented Oct 17, 2025

I updated the messages of the deprecation and the future exceptions.

@GromNaN GromNaN requested a review from derrabus October 19, 2025 06:48
@xabbuh xabbuh added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Oct 19, 2025
------

* Deprecate accessing the internal scope of the loader in PHP config files, use only its public API instead
* Deprecate setting a default value to a node that is required, and vice versa
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Deprecate setting a default value to a node that is required, and vice versa
* Deprecate setting a default value to a node that is required

I think it's understandable like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry I missed your comment and merged.
I used a different wording for the 8.0 branch: #62109

@GromNaN GromNaN merged commit 9ef8396 into symfony:7.4 Oct 19, 2025
17 of 18 checks passed
@GromNaN GromNaN deleted the config-default-required branch October 19, 2025 19:01
GromNaN added a commit that referenced this pull request Oct 22, 2025
…isRequired()` and `defaultValue()` (GromNaN)

This PR was merged into the 8.0 branch.

Discussion
----------

[Config] Ensure configuration nodes do not have both `isRequired()` and `defaultValue()`

| Q             | A
| ------------- | ---
| Branch?       | 8.0
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #62076
| License       | MIT

Convert deprecation introduced in #62090 into an exception.

Commits
-------

59f69e0 [Config] Ensure configuration nodes does not have both isRequired() and defaultValue()
symfony-splitter pushed a commit to symfony/config that referenced this pull request Oct 22, 2025
…isRequired()` and `defaultValue()` (GromNaN)

This PR was merged into the 8.0 branch.

Discussion
----------

[Config] Ensure configuration nodes do not have both `isRequired()` and `defaultValue()`

| Q             | A
| ------------- | ---
| Branch?       | 8.0
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix symfony/symfony#62076
| License       | MIT

Convert deprecation introduced in symfony/symfony#62090 into an exception.

Commits
-------

59f69e0127b [Config] Ensure configuration nodes does not have both isRequired() and defaultValue()
This was referenced Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Config Deprecation ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Config] The config builder should reject required parameter with a default value

6 participants