Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] use #[Required] for ServiceSubscriberTrait::setContainer() #45680

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

kbond
Copy link
Member

@kbond kbond commented Mar 8, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #45679
License MIT
Doc PR n/a

Can't use for Symfony\Bundle\FrameworkBundle\Controller::setContainer() until we bump the min version of service-contracts.

@carsonbot carsonbot added this to the 6.1 milestone Mar 8, 2022
@kbond kbond modified the milestones: 6.1, 6.0 Mar 8, 2022
@nicolas-grekas
Copy link
Member

Can't use for Symfony\Bundle\FrameworkBundle\Controller::setContainer()

maybe add both the annotation and the attribute?

@kbond kbond force-pushed the minor/required-attribute branch from 1ce4c2c to 596e9d4 Compare March 9, 2022 13:35
@kbond
Copy link
Member Author

kbond commented Mar 9, 2022

maybe add both the annotation and the attribute?

Done.

@nicolas-grekas
Copy link
Member

Do you mean to target 6.0 or 6.1? 6.1 I guess, since that's not a bugfix, right?

@nicolas-grekas
Copy link
Member

Or 5.4 if it's a bugfix?

@kbond
Copy link
Member Author

kbond commented Mar 9, 2022

I meant to target 6.0 as a minor change. Not really a bug fix or feature but can target 6.1 if desired. If I target 5.4, I'll have to leave the @required annotation for ServiceSubscriber trait - with 6.0+, I don't have to.

@chalasr
Copy link
Member

chalasr commented Mar 9, 2022

We'd better merge this on 6.1 IMHO

@kbond kbond force-pushed the minor/required-attribute branch from 596e9d4 to 24646c4 Compare March 9, 2022 15:18
@kbond kbond modified the milestones: 6.0, 6.1 Mar 9, 2022
@fabpot
Copy link
Member

fabpot commented Mar 9, 2022

Thank you @kbond.

@fabpot fabpot merged commit cd62c2d into symfony:6.1 Mar 9, 2022
@kbond kbond deleted the minor/required-attribute branch March 9, 2022 18:28
@fabpot fabpot mentioned this pull request Apr 15, 2022
@derrabus
Copy link
Member

This change might have caused #48792.

@alexislefebvre
Copy link
Contributor

Can't use for Symfony\Bundle\FrameworkBundle\Controller::setContainer() until we bump the min version of service-contracts.

Is it still the case now that Contracts v1 have been dropped? See #48810

If I remove @required to keep only #[Required], then it fixes the issue #48792

fabpot added a commit that referenced this pull request Jan 7, 2023
…ibute (alexislefebvre)

This PR was merged into the 6.3 branch.

Discussion
----------

[FrameworkBundle] remove double required annotation + attribute

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #48792 (checked with [this reproducer](#48792 (comment)))
| License       | MIT
| Doc PR        | no

Annotation and attribute were kept: #45680 (comment)

To my understanding, it's not necessary since #48810

Alternative to #48868

Commits
-------

8e8772d remove double required annotation + attribute
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jan 7, 2023
…ibute (alexislefebvre)

This PR was merged into the 6.3 branch.

Discussion
----------

[FrameworkBundle] remove double required annotation + attribute

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #48792 (checked with [this reproducer](symfony/symfony#48792 (comment)))
| License       | MIT
| Doc PR        | no

Annotation and attribute were kept: symfony/symfony#45680 (comment)

To my understanding, it's not necessary since #48810

Alternative to #48868

Commits
-------

8e8772d2c1 remove double required annotation + attribute
@m-vo
Copy link
Contributor

m-vo commented Jan 23, 2023

IMHO the framework bundle must require the service contracts in at least ^2.2 now (or conflict with them in a lower version). Otherwise you'll get the following error during compilation:

[Semantical Error] The annotation "@Symfony\Contracts\Service\Attribute\Required" in method Symfony\Bundle\FrameworkBundle\Controller\AbstractController::setContainer() was never imported. Did you maybe forget to add a "use" statement for this annotation? 

@derrabus
Copy link
Member

@m-vo Please read the previous comments. I'm locking here to avoid more "me too" posts.

@symfony symfony locked and limited conversation to collaborators Jan 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ServiceSubscriberTrait - Should use Required attribute for setContainer instead of annotation
8 participants