-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
[make:controller] avoid require doctrine/annotation when can use attributes #858
[make:controller] avoid require doctrine/annotation when can use attributes #858
Conversation
src/Maker/MakeController.php
Outdated
if (null === $phpCompatUtil) { | ||
$phpCompatUtil = new PhpCompatUtil($fileManager); | ||
|
||
trigger_deprecation('symfony/maker-bundle', '1.31', 'Initializing MakeController without providing an instance of PhpCompatUtil is deprecated.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is heavily inspired on https://github.com/symfony/maker-bundle/blob/main/src/Generator.php#L40, tell me if it's not needed in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it is worth it. When maker-bundle
will require PHP 8 as a minimum version, we'll most likely drop the dependency to PhpCompatUtil
, so in my opinion it's not useful to make this dependency mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the deprecation here. PhpCompatUtil
is internal & MakeController
is final - I don't see a use case where someone would use a version >=1.31 and not be able to initiate MakeController
w/o the utility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation removed 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Jibbarth This PR will have to wait for the resolution of symfony/recipes#916 before it can be merged.
So maybe we should create the config/routes/annotation.yaml in case we can use attributes AND file does not exist ? WDYT ?
I'm not a fan of this idea. That responsibility falls on recipes / flex in my opinion.
src/Maker/MakeController.php
Outdated
if (null === $phpCompatUtil) { | ||
$phpCompatUtil = new PhpCompatUtil($fileManager); | ||
|
||
trigger_deprecation('symfony/maker-bundle', '1.31', 'Initializing MakeController without providing an instance of PhpCompatUtil is deprecated.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the deprecation here. PhpCompatUtil
is internal & MakeController
is final - I don't see a use case where someone would use a version >=1.31 and not be able to initiate MakeController
w/o the utility.
4d63ab8
to
37472d7
Compare
37472d7
to
abbfa18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Jibbarth! we can finally get this merged in!
Note: To preserve BC, |
Hi makers 👋 !
This PR allows to make controller when we can use PHP8 attributes without forcing to install
doctrine/annotation
But we should be aware that currently, without
doctrine/annotation
, we don't have a nice flex recipe that enable routing annotation read on Controller folder.See symfony/recipes#916 for reference.
So maybe we should create the config/routes/annotation.yaml in case we can use attributes AND file does not exist ? WDYT ?