-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Move AddConsoleCommandPass from FrameworkBundle to Console. #19443
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
Conversation
bcremer
commented
Jul 27, 2016
•
edited
Loading
edited
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | yes |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #19440 |
License | MIT |
Doc PR | - |
c2deecc
to
dffd5e6
Compare
Maybe worth merging (or reviewing) #19305 first so that it doesnt conflict. |
@@ -22,6 +22,7 @@ | |||
"symfony/class-loader": "~3.2", | |||
"symfony/dependency-injection": "~3.2", | |||
"symfony/config": "~2.8|~3.0", | |||
"symfony/console": "~3.2", |
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 can be removed. Because of the class_exists call, if the installed component is an older version or isn't installed it will still work. Maybe should you add a another test to not load the deprecated pass if the component is not installed at all (to prevent throwing an illegitimate deprecation warning).
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.
Removed the dependency.
b6f8cc5
to
94a19f3
Compare
*/ | ||
class AddConsoleCommandPass implements CompilerPassInterface | ||
{ | ||
public function __construct() | ||
{ | ||
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', __CLASS__), E_USER_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 should be jus below the namespace declaration, see other places in the code base
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.
Good point, changed.
94a19f3
to
1094537
Compare
@@ -11,13 +11,17 @@ | |||
|
|||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; | |||
|
|||
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', __CLASS__), E_USER_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.
AddConsoleCommandPass::class instead of __CLASS__
(which is undefined)
1094537
to
17385a7
Compare
"symfony/filesystem": "~2.8|~3.0", | ||
"symfony/process": "~2.8|~3.0", | ||
"psr/log": "~1.0" | ||
}, | ||
"suggest": { | ||
"symfony/dependency-injection": "", |
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 would remove this suggestion. The DI component does not allow to add more features to the Console component.
The compiler pass is useful only for people already using the component. So the suggestion is just useless noise.
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.
Makes sense; changed.
17385a7
to
6e57865
Compare
Tests do not pass because of the deprecation. |
6e57865
to
db03053
Compare
Tests are now all fixed. |
@@ -6,6 +6,7 @@ FrameworkBundle | |||
|
|||
* The `Controller::getUser()` method has been deprecated and will be removed in | |||
Symfony 4.0; typehint the security user object in the action instead. | |||
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been deprecated. Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead. |
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.
Please also add this to the UPGRADE-4.0.md
(but reword it to "removed" there).
$container->compile(); | ||
} | ||
|
||
public function testHttpKernelRegisterCommandsIngoreCommandAsAService() |
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 whole test case looks a bit suspicious to me. We don't have anything HttpKernel specific here, do we?
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.
The test was copied 1 to 1 from the original location
\Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\AddConsoleCommandPassTest::testHttpKernelRegisterCommandsIngoreCommandAsAService
.
Any suggestions how to name the testcase instead?
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.
Imo this test case should have never lived here. It actually does not test test compiler pass, but the bundle class from the HttpKernel component and therefore should live there.
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.
see #20273
* | ||
* @author Grégoire Pineau <[email protected]> | ||
* | ||
* @deprecated since version 3.2, to be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead. | ||
*/ | ||
class AddConsoleCommandPass implements CompilerPassInterface |
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.
Wouldn't it be better to let this class extend the new compiler pass instead of having to maintain the same code twice?
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 would introduce a new dependency symfony/console
to symfony/framework-bundle
that is not yet defined in composer.json.
Should the new dependency be added to composer.json or can should this fail during runtime?
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.
We could add a conflict rule for versions of the Console component before 3.2.
014c9eb
to
cf946c9
Compare
@@ -11,14 +11,18 @@ | |||
|
|||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; | |||
|
|||
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', AddConsoleCommandPass::class), E_USER_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.
[...] deprecated since version 3.2 [...]
cf946c9
to
e7f2763
Compare
👍 (failure is unrelated) Status: Reviewed |
Should we make some hardcoded id's / strings configurable thru required constructor args, as done in #20250? See discussion: #20250 (comment) |
…l component (xabbuh) This PR was merged into the 2.7 branch. Discussion ---------- [FrameworkBundle][HttpKernel] move test to the HttpKernel component | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19443 (comment) | License | MIT | Doc PR | The moved test case does not test the `AddConsoleCommandPass` class, but ensures certain behavior in the `registerCommands()` method of the `Bundle` class from the HttpKernel component. Commits ------- c9ca322 move test to the HttpKernel component
Is there still anything I can help to get this merged into 3.3? |
@bcremer You rebase this once again to resolve conflicts, but otherwise this looks ready to me. ping @symfony/deciders |
@@ -27,6 +27,7 @@ FrameworkBundle | |||
* The `Resources/public/images/*` files have been removed. | |||
* The `Resources/public/css/*.css` files have been removed (they are now inlined | |||
in TwigBundle). | |||
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been deprecated. Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead. |
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.
Ah sorry, now that Symfony 3.2 is released we would need to move this to the UPGRADE-3.2md
file and update deprecation messages accordingly.
e7f2763
to
4928c24
Compare
4928c24
to
7743989
Compare
@xabbuh Rebased onto |
Thank you @bcremer. |
…dle to Console. (bcremer) This PR was merged into the 3.3-dev branch. Discussion ---------- [Console] Move AddConsoleCommandPass from FrameworkBundle to Console. | Q | A | | --- | --- | | Branch? | master | | Bug fix? | no | | New feature? | yes | | BC breaks? | yes | | Deprecations? | yes | | Tests pass? | yes | | Fixed tickets | #19440 | | License | MIT | | Doc PR | - | Commits ------- 7743989 Move AddConsoleCommandPass from FrameworkBundle to Console.
…ent isn't installed (dunglas) This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Prevent an error when the console component isn't installed | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21246 | License | MIT | Doc PR |n/a Finish #19443. Alternative to #21246. Commits ------- ab133ca [FrameworkBundle] Prevent an error when the console component isn't installed
…onent (chalasr) This PR was merged into the 3.3-dev branch. Discussion ---------- [Form][FrameworkBundle] Move FormPass to the Form component | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a So that anyone using only Form and DI can use it for registering form types/type guessers. Follows #19443, related to #21284 Commits ------- e68a6d9 [FrameworkBundle][Form] Move FormPass to the Form component