8000 [FrameworkBundle] [Routing] DelegatingLoader: remove unused logger by ogizanagi · Pull Request #16117 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] [Routing] DelegatingLoader: remove unused logger #16117

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

Closed
wants to merge 1 commit into from
Closed

[FrameworkBundle] [Routing] DelegatingLoader: remove unused logger #16117

wants to merge 1 commit into from

Conversation

ogizanagi
Copy link
Contributor
Q A
Bug fix? no
New feature? no
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #6298
License MIT
Doc PR -

There is no harm into keeping it, but I think 3.0 is the occasion to remove such things.
Also proposed in #11742

* @param LoaderResolverInterface $resolver A LoaderResolverInterface instance
*/
public function __construct(ControllerNameParser $parser, LoggerInterface $logger = null, LoaderResolverInterface $resolver)
public function __construct(ControllerNameParser $parser, LoaderResolverInterface $resolver)
Copy link
Member

Choose a reason for hiding this comment

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

What about deprecating the $logger argument in Symfony 2.8 before?

Copy link
Member

Choose a reason for hiding this comment

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

removing the argument in the middle of the signature is a BC break.

It is required to accept the new API in 2.8 already to ease the migration (and to throw a deprecation warning when using the old signature)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, what should be done in order to have both old and new api compatible in 2.8 ? Something like:

/**
 * @param ControllerNameParser                    $parser   A ControllerNameParser instance
 * @param LoggerInterface|LoaderResolverInterface $logger   A LoggerInterface instance
 * @param LoaderResolverInterface|null            $resolver A LoaderResolverInterface instance
 */
public function __construct(ControllerNameParser $parser, $logger = null, $resolver = null)
{
    $this->parser = $parser;
    $this->logger = $logger instanceof LoggerInterface ? $logger : null;

    parent::__construct($logger instanceof LoaderResolverInterface ? $logger : $resolver);
}

(the old api will still be used by the FrameworkBundle in 2.8 I guess) and raising a deprecation warning when subclasses access the $logger property by using a magic getter as @Tobion suggested ?
Pretty confusing.

Copy link
Member

Choose a reason for hiding this comment

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

The deprecation warning should be triggered when a logger is passed as the second argument in Symfony 2.8. You can take a look at the FragmentHandler for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xabbuh : Thanks for the reference. If I understand you right, this is what the changes would be like: 2.8...ogizanagi:2_8/delegating_loader_logger_deprecation
If it looks good to you, I'll create a second PR to merge before this one into 2.8.

Copy link
Member

Choose a reason for hiding this comment

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

I will need some changes, but I think it's easier if you make the pull request and we can give you feedback there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, opened: #16135

@@ -28,20 +27,17 @@
class DelegatingLoader extends BaseDelegatingLoader
{
protected $parser;
protected $logger;
Copy link
Contributor

Choose a reason for hiding this comment

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

we could also raise a deprecation warning when subclasses access this property by using a magic getter for it.

fabpot added a commit that referenced this pull request Oct 6, 2015
…logger argument (ogizanagi)

This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] [Routing] DelegatingLoader: deprecate logger argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Related to #16117

Commits
-------

af0eba7 [FrameworkBundle] [Routing] DelegatingLoader: deprecate logger argument
@fabpot fabpot closed this Oct 11, 2015
@ogizanagi ogizanagi deleted the 3.0/routing_delegating_loader_unused_logger branch October 11, 2015 09:57
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.

6 participants
0