shopware-rector icon indicating copy to clipboard operation
shopware-rector copied to clipboard

AbstractMessageHandler

Open tinect opened this issue 2 years ago • 2 comments

Please describe the feature you would like to see implemented.

It would be nice, if the old AbstractMessageHandler could be migrated to AsMessageHandler attribute

tinect avatar Jun 19 '23 19:06 tinect

@tinect @shyim Needed this as well, i've wrote a working rule for it. To be honest, it's 99% generated by gpt-4, but it does work. Could be a starting point :-)

It does the following:

  1. Removes extends statement and adds Attribute "AsMessageHandler"
  2. Searches for any method name containing "message", implements __invoke method and calls this function
  3. Removes getHandledMessages method
  4. Adds import for AsMessageHandler if not present

Works in my case, however i am still refactoring and can't say its production-ready :-)

See https://github.com/alexschwarz89/shopware-rector/commit/6ee17addd9f9c85b9c8f8d3edebe746d8fa3ba72

alexschwarz89 avatar Dec 01 '23 12:12 alexschwarz89

Hey,

do you want to create a PR. looks okay for me :)

shyim avatar Jun 08 '24 07:06 shyim