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

Register listener events using typehints #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ravedok
Copy link

@ravedok ravedok commented May 31, 2019

Hello,

I think it would be interesting to be able to define the event that a listener will execute by means of typehints.

I hope that the code will serve you at least as a test.

my.listener:
    class: App\Listener\\MyListener
    tags:
        - { name: tactician.event_listener, typehints: true }

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

Copy link
Owner

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

Sorry for the delay with review. This looks really interesting.

I've added a few comments.

Also, could you please update the README to include information about this new feature?

--

If you have time, could you please add some tests?

|| $method->isStatic()
|| $method->isAbstract()
|| $method->isVariadic()
|| $method->getNumberOfParameters() !== 1
Copy link
Owner

Choose a reason for hiding this comment

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

Should we handle methods like __get() here?

Copy link
Author

Choose a reason for hiding this comment

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

I think I would not know how to do it. I did a tribute (copy + paste + adapt) to the typehint function that uses the tactician-bundle https://github.com/thephpleague/tactician-bundle/blob/bf10a37e27e4306bb9de5d909dba36226aa8e3c4/src/DependencyInjection/HandlerMapping/TypeHintMapping.php

src/DependencyInjection/TacticianDomainEventExtension.php Outdated Show resolved Hide resolved
src/DependencyInjection/TacticianDomainEventExtension.php Outdated Show resolved Hide resolved
@ravedok
Copy link
Author

ravedok commented Jun 22, 2019

I have corrected some things and added the documentation, of the tests I do not think I can take care of right now I'm sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants