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

[Console][LockableTrait] Do not redeclare $lockFactory through constructor property promotion in the code example#21507

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

Merged
javiereguiluz merged 1 commit intosymfony:7.3fromnicuserban:patch-1
Oct 17, 2025

Conversation

@nicuserban
Copy link
Contributor

Adding visibility on the constructor parameter results in constructor property promotion and in redeclaring the property in a way which is incompatible with the declaration from the trait, resulting in a fatal error if the example is used as is. For reference:https://www.php.net/manual/en/language.oop5.traits.php#language.oop5.traits.properties.example
Instead, I think the visibility should be removed in order to prevent redeclaration (and incompatibility with the property from the trait), and just use dependency injection and overwrite the default value so that the trait won't create a new instance for the $lockFactory.

…erty promotion in the code exampleAdding visibility on the constructor parameter results in constructor property promotion and in redeclaring the property in a way which is incompatible with the declaration from the trait, resulting in a fatal error if the example is used as is.For reference:https://www.php.net/manual/en/language.oop5.traits.php#language.oop5.traits.properties.exampleInstead, I think the visibility should be removed in order to prevent redeclaration (and incompatibility with the property from the trait), and just use dependency injection and overwrite the default value so that the trait won't create a new instance for the $lockFactory.
@carsonbotcarsonbot changed the title[LockableTrait]Do not redeclare $lockFactory through constructor property promotion in the code example[LockableTrait] Do not redeclare $lockFactory through constructor property promotion in the code exampleOct 16, 2025
@carsonbotcarsonbot changed the title[LockableTrait] Do not redeclare $lockFactory through constructor property promotion in the code example[Console][LockableTrait] Do not redeclare $lockFactory through constructor property promotion in the code exampleOct 17, 2025
@javiereguiluzjaviereguiluz merged commitfa8ff31 intosymfony:7.3Oct 17, 2025
3 checks passed
@javiereguiluz
Copy link
Member

Good catch Nicolae 👏 and perfectly explained in the PR desription. Thanks for fixing this.

@nicuserban
Copy link
ContributorAuthor

nicuserban commentedOct 17, 2025
edited
Loading

Good catch Nicolae 👏 and perfectly explained in the PR desription. Thanks for fixing this.

Thank you for your review and for merging this PR, Javier!

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

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@nicuserban@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp