php-resque icon indicating copy to clipboard operation
php-resque copied to clipboard

[WIP] Introduce Namespaces

Open pprkut opened this issue 3 years ago • 3 comments

This is a request for comments on introducing namespaces to php-resque :slightly_smiling_face:

The files are reorganized quite a bit to make namespaces more natural. I summarize as best as I can:

  • All exceptions now can be found in lib/Exceptions
    • Rename DontCreate to DoNotCreateException
    • Rename DontPerform to DoNotPerformException
  • All job related classes can be found in lib\Job
  • All failure related classes can be found in lib\Failure
  • The resque and resquescheduler Worker classes have been renamed to ResqueWorker and SchedulerWorker and moved to lib/Worker
  • Resque_Failure has been renamed to FailureHandler
    • This because Resque_Failure worked with Failures, but wasn't one itself
  • Resque_Job has been renamed to JobHandler.
    • Similar to Resque_Failure. Additionally this would also allow us to introduce an actual Job class later that can be used for inheritance
  • Plus some more other minor renames

Code and code comments have been updated, but there's a chance I missed some. Unit tests are updated as well though, and pass. However, I didn't update documentation until the actual implementation is agreed upon.

PR is based on #55, because working with the unit tests was easier that way.

Fixes #36

pprkut avatar Dec 30 '21 16:12 pprkut

Import statements must not begin with a leading backslash

I did it so we can have Resque\Exceptions\Exception extending Exception. Without the leading backslash name resolution gets confusing. Then it would be better to rename the exception to Resque\Exceptions\ResqueException (which would also allow to remove the aliasing I did in the code to better differentiate it (ResqueException) from the one in core (CoreException))

pprkut avatar Dec 30 '21 17:12 pprkut

it would be better to rename the exception

Go ahead. We're renaming everything already anyway. 🙂

danhunsaker avatar Mar 17 '22 15:03 danhunsaker

@danhunsaker I think I got everything now. At least I can no longer find references to the old class names. Didn't yet really proof-read the documentation though

pprkut avatar Mar 19 '22 14:03 pprkut

No idea why I moved this back to main, it's meant to stay on develop. Can you rebase?

danhunsaker avatar Jul 13 '23 19:07 danhunsaker

I opened it against main at the time, couldn't point it to develop until #60 as merged. But should be all good now :slightly_smiling_face:

pprkut avatar Jul 13 '23 19:07 pprkut