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

Introduce Namespaces #56

Merged
merged 8 commits into from
Jul 14, 2023
Merged

Introduce Namespaces #56

merged 8 commits into from
Jul 14, 2023

Conversation

pprkut
Copy link
Collaborator

@pprkut pprkut commented Dec 30, 2021

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

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
Copy link
Collaborator Author

pprkut commented Dec 30, 2021

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))

@danhunsaker
Copy link
Member

it would be better to rename the exception

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

@danhunsaker danhunsaker changed the base branch from main to develop March 19, 2022 14:23
@danhunsaker danhunsaker changed the base branch from develop to main March 19, 2022 14:28
@pprkut
Copy link
Collaborator Author

pprkut commented Mar 19, 2022

@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

@danhunsaker danhunsaker changed the base branch from main to develop July 13, 2023 19:05
@danhunsaker
Copy link
Member

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

@pprkut pprkut changed the title [WIP] Introduce Namespaces Introduce Namespaces Jul 13, 2023
@pprkut
Copy link
Collaborator Author

pprkut commented Jul 13, 2023

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

@danhunsaker danhunsaker merged commit 54966de into resque:develop Jul 14, 2023
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.

Suggestion: PSR-4 compliant namespace
2 participants