8000 [Config] ReflectionClassResource check abstract class by andrey1s · Pull Request #26400 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Config] ReflectionClassResource check abstract class #26400

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 13, 2018
Merged

[Config] ReflectionClassResource check abstract class #26400

merged 1 commit into from
Mar 13, 2018

Conversation

andrey1s
Copy link
@andrey1s andrey1s commented Mar 5, 2018

generate Signature
update hash methods ServiceSubscriberInterface::getSubscribedServices and EventSubscriberInterface::getSubscribedEvents if the class is not abstract

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26459, #26501
License MIT

@andrey1s andrey1s closed this Mar 5, 2018
@andrey1s andrey1s changed the base branch from master to 4.0 March 5, 2018 09:11
@andrey1s andrey1s reopened this Mar 5, 2018
@andrey1s andrey1s changed the base branch from 4.0 to 3.4 March 5, 2018 09:14
@andrey1s andrey1s changed the base branch from 3.4 to 4.0 March 5, 2018 09:15
@andrey1s andrey1s changed the base branch from 4.0 to 3.4 March 5, 2018 09:20
@jakzal
Copy link
Contributor
jakzal commented Mar 8, 2018

What's the problem you're fixing here? Does it fix #26459?

@andrey1s
Copy link
Author
andrey1s commented Mar 8, 2018

@jakzal yes, add issue

}

if ($class->isSubclassOf(ServiceSubscriberInterface::class)) {
yield ServiceSubscriberInterface::class;
yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
if (!$class->isAbstract()) {
Copy link
Member

Choose a reason for hiding this comment

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

should also check for isInterface()

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Mar 12, 2018
@@ -157,12 +157,16 @@ private function generateSignature(\ReflectionClass $class)

if ($class->isSubclassOf(EventSubscriberInterface::class)) {
yield EventSubscriberInterface::class;
yield print_r(\call_user_func(array($class->name, 'getSubscribedEvents')), true);
if (!$class->isAbstract()) {
Copy link
Member

Choose a reason for hiding this comment

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

the check should be merged in the above "if", no need to yield EventSubscriberInterface::class
(same below, and I agree with @chalasr comment below also)

Copy link
Member

Choose a reason for hiding this comment

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

or, just before the current two checks, we could just add

if ($class->isAbstract() || $class->isInterface()) {
    return;
}

Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(comments addressed by push-forcing on the fork)

@fabpot
Copy link
Member
fabpot commented Mar 13, 2018

Thank you @andrey1s.

@fabpot fabpot merged commit e851514 into symfony:3.4 Mar 13, 2018
fabpot added a commit that referenced this pull request Mar 13, 2018
…rey1s)

This PR was merged into the 3.4 branch.

Discussion
----------

[Config] ReflectionClassResource check abstract class

generate Signature
update hash methods `ServiceSubscriberInterface::getSubscribedServices` and `EventSubscriberInterface::getSubscribedEvents` if the class is not abstract

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26459, #26501
| License       | MIT

Commits
-------

e851514 [Config] ReflectionClassResource check abstract ServiceSubscriberInterface and EventSubscriberInterface
@andrey1s andrey1s deleted the config/signature branch March 13, 2018 13:22
This was referenced Apr 3, 2018
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