Skip to content
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

[FrameworkBundle][WebProfilerBundle] Move ProfilerPass to the WebProfiler bundle #21368

Closed
wants to merge 1 commit into from

Conversation

Deamon
Copy link
Contributor

@Deamon Deamon commented Jan 21, 2017

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes/no
Fixed tickets -
License MIT
Doc PR n/a

This MR is part of the #21284 todo list

@@ -34,6 +34,9 @@ FrameworkBundle
---------------

* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been deprecated. Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead.

* The `ProfilerPass` class has been deprecated and will be removed in 4.0, use the
`Symfony\Bundle\WebProfilerBundle\DependencyInjection\ProfilerPass` class instead.
Copy link
Member

Choose a reason for hiding this comment

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

This is missing the Compiler part of the namespace.

@@ -156,6 +156,9 @@ FrameworkBundle

* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been removed. Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead.

* The `ProfilerPass` class has been removed, use the
Copy link
Member

Choose a reason for hiding this comment

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

same here

@@ -74,7 +74,10 @@ public function build(ContainerBuilder $container)
parent::build($container);

$container->addCompilerPass(new RoutingResolverPass());
$container->addCompilerPass(new ProfilerPass());
if (class_exists(AddConsoleCommandPass::class)) {
Copy link
Member

Choose a reason for hiding this comment

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

This change does not look related to the goal of the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, this will be deleted.

if (class_exists(AddConsoleCommandPass::class)) {
$container->addCompilerPass(new AddConsoleCommandPass());
}
$this->addCompilerPassIfExists($container, ProfilerPass::class);
Copy link
Member

Choose a reason for hiding this comment

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

You have to specify the FQCN of an alternative implementation (the already existing one) that will be used as a fallback to provide backwards compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're saying that I should write

if (class_exists(ProfilerPass::class)) {
    $container->addCompilerPass(new ProfilerPass());
}

and duplicate the code ?
or just say somewhere that I took this part of the code from #21283 which has already been reviewed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or do I have to link to the old Implementation ?

or the last chance, make an if/else to import the new one or the old one ?

Copy link
Member

@chalasr chalasr Jan 21, 2017

Choose a reason for hiding this comment

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

@xabbuh In fact this doesn't expect a fallback. For the AddConsoleCommandPass, we just added a conflict to the frameworkbundle so that it is always available (it was your suggestion #19443 (comment)). I started to do the same for the FormPass (#21283) and SerializerPass(#21293), is it ok to do the same here or should we fallback to the deprecated one and mute deprecation instead?

Copy link
Member

Choose a reason for hiding this comment

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

You are right. Adding the conflict rule should be the solution here too.

* file that was distributed with this source code.
*/

namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;
Copy link
Member

Choose a reason for hiding this comment

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

Should be moved to the Compiler subnamespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I change only the namespace or move the file in a subdirectory ?

Copy link
Member

Choose a reason for hiding this comment

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

@xabbuh is it worth it? We did not do it for the AddConsoleCommandPass in #19443, going to do the same for FormPass and SerializerPass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In AddConsoleCommandPass you were moving the file from Symfony\Bundle\FrameworkBundle to the component.
Here I am moving the file from Symfony\Bundle\FrameworkBundle to Symfony\Bundle\WebProfilerBundle.
After a short looking I figured that every "Bundle" in that namespace have a repository Compiler in there DIfolder so I think in that case I should move it in a subfolder.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, the Compiler subnamespace seems to concern bundles only, sorry.

@chalasr
Copy link
Member

chalasr commented Jan 21, 2017

#21284 should not be closed after this, it will only be partially fixed.

@Deamon
Copy link
Contributor Author

Deamon commented Jan 21, 2017

@chalasr I updated the description to reflect that.

@Deamon
Copy link
Contributor Author

Deamon commented Jan 21, 2017

@xabbuh, @chalasr, I did a mistake while commiting validated fixes, this discussion still open

@Deamon Deamon changed the title WIP: [FrameworkBundle][WebProfilerBundle] Move ProfilerPass to the WebProfiler bundle [FrameworkBundle][WebProfilerBundle] Move ProfilerPass to the WebProfiler bundle Jan 22, 2017
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

The FrameworkBundle's composer.json needs a conflict rule for "symfony/web-profiler-bundle": "<3.3", and its changelog needs a mention for the deprecated pass.

@Deamon
Copy link
Contributor Author

Deamon commented Jan 22, 2017

The conflict line has been added in the composer.json file and a note in the changelog of the FrameworkBundle.

@@ -57,7 +57,8 @@
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0",
"phpdocumentor/type-resolver": "<0.2.0",
"symfony/console": "<3.3"
"symfony/console": "<3.3",
"symfony/web-profiler-bundle": "<3.3"
Copy link
Member

Choose a reason for hiding this comment

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

"symfony/web-profiler-bundle": "~3.3" must be added as dev requirement in addition of the conflict, that should make the build green.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I figured in your comment .
The fix is coming.

@Deamon Deamon force-pushed the move-profiler-pass branch 2 times, most recently from 3c7e18f to ebe2b93 Compare January 23, 2017 15:43
@stof
Copy link
Member

stof commented Jan 23, 2017

-1 for this. the configuration to enable the profiler itself is also part of FrameworkBundle.

WebProfilerBundle is currently only responsible for building a UI for the profiler, not for integrating the profiler itself.
The profiler is part of HttpKernel, not of WebProfilerBundle

@chalasr
Copy link
Member

chalasr commented Jan 24, 2017

@stof is right as usual.

Removed this pass from the list, might be reconsidered if we come to extract the profiler from the HttpKernel to its own component, but its place is not the WebProfilerBundle for sure.
I'll double check the remaining tasks of #21284 to avoid such issues.

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Jan 24, 2017
@fabpot
Copy link
Member

fabpot commented Feb 16, 2017

Closing as this is indeed wrong.

@fabpot fabpot closed this Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants