Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Config] Allow to always use config classes#51544

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@alexndlm
Copy link
Contributor

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

When the config node doesn't have normalization, using the config object is impossible.

When the config node has some array normalization (likehttp_codes in\Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration::addHttpClientRetrySection), it is not possible to use the config object.

This PR relates to changes introduced in:

Снимок экрана 2023-09-01 в 22 22 28

@nicolas-grekas
Copy link
Member

Thanks for working on this, it's related to the limitation I found in#51273
Can you please rebase+target 6.4? That's an improvement, not a bugfix to me.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

The changes on the Config components are BC breaks. Can we find a way that doesn't break BC?

if ($this->default) {
if (!\is_array($this->defaultValue)) {
thrownew \InvalidArgumentException(sprintf('%s: the default value of an array node has to be an array.',$node->getPath()));
thrownew \InvalidArgumentException(sprintf('"%s": the default value of an array node has to be an array.',$node->getPath()));

Choose a reason for hiding this comment

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

should be reverted, that's a false-positive from fabbot I suppose


protected$node;

public$allowedTypes;

Choose a reason for hiding this comment

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

removing consts and public properties is a BC break, we need to figure out a way that doesn't break BC

@alexndlmalexndlmforce-pushed thefeature/config-allow-to-always-use-config-classes branch fromf4bb242 to72e1fd0CompareNovember 11, 2023 14:08
@alexndlmalexndlm marked this pull request as draftNovember 11, 2023 14:13
@alexndlmalexndlm changed the base branch from6.3 to6.4November 11, 2023 14:13
@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4Feb 1, 2024
$parameterTypes =$this->getParameterTypes($node);
$comment .=' * @param ParamConfigurator|'.implode('|',$parameterTypes).' $value'."\n";
$parameterType =$this->getParameterType($node);
if (null ===$parameterType ||'' ===$parameterType) {
Copy link
Member

Choose a reason for hiding this comment

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

why returning an empty string to meanmixed instead of returningmixed ?

* @template TValue
* @param TValue $value
* @return \Symfony\Config\NodeInitialValues\MessengerConfig|$this
* @psalm-return (TValue is array ? \Symfony\Config\NodeInitialValues\MessengerConfig : static)
Copy link
Member

Choose a reason for hiding this comment

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

why should passing an array return a MessengerConfig while passing another kind of value would be fluent ? What does this correspond to ?

Copy link
Member

@nicolas-grekasnicolas-grekasSep 19, 2025
edited
Loading

Choose a reason for hiding this comment

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

I wondered about the same and I think I've got the answer:

  • When you pass a non-array, you likely won't want to configure anything else nested in the tree you're configuring. That's what happens for other config formats, structurally.
  • When you pass an array, you can configure nested options, so that then it might make sense to return the nested config-builder.

I'm just wondering about the check: should we return the config-builder when the array is non empty?
Or should we do this?

Suggested change
* @psalm-return (TValue is array ? \Symfony\Config\NodeInitialValues\MessengerConfig : static)
* @psalm-return (TValue isnon-empty-array ?$this :\Symfony\Config\NodeInitialValues\MessengerConfig)

* @return $this
*/
publicfunctionkeyedArray(string$name,ParamConfigurator|string|array$value):static
publicfunctionkeyedArray(string$name,mixed$value):static
Copy link
Member

Choose a reason for hiding this comment

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

this type becoming wider looks like a regression to me.

@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.4Sep 24, 2025
@nicolas-grekas
Copy link
Member

Let me close as stalled and superseded by#51273
Feel free to open an issue to describe any remauning issue of course.

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

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@kbondkbondAwaiting requested review from kbond

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

5 participants

@alexndlm@nicolas-grekas@stof@carsonbot@jderusse

[8]ページ先頭

©2009-2025 Movatter.jp