Skip to content

Conversation

@huangdijia
Copy link
Member

Summary

This PR refactors the AnnotationJob class to modernize the code with PHP 8.0+ features and improve code clarity.

Changes

  • Constructor Property Promotion: Converted class properties to use constructor property promotion, reducing boilerplate code
  • Code Cleanup: Removed redundant variable assignments and improved code structure
  • Method Invocation: Used arrow function with ->call() for cleaner method invocation on the instance
  • Formatting: Improved overall code formatting and readability

Technical Details

The refactoring maintains backward compatibility while:

  • Reducing the number of lines of code from 57 to 49
  • Eliminating manual property assignments in the constructor
  • Simplifying the handle() method logic
  • Using modern PHP syntax features

Impact

  • No breaking changes to the public API
  • All existing functionality remains intact
  • Improved code maintainability and readability

huangdijia and others added 5 commits November 7, 2025 10:37
…tion and clean up code

- Convert class properties to constructor property promotion (PHP 8.0+)
- Simplify code structure and improve readability
- Use arrow function with ->call() for method invocation
- Clean up formatting and remove redundant variable assignments
- Maintain backward compatibility with existing functionality
@huangdijia huangdijia changed the title refactor(async-queue): modernize AnnotationJob with constructor promotion and clean up code Optimized AnnotationJob to support call protect / private methods. Nov 8, 2025
@huangdijia huangdijia changed the title Optimized AnnotationJob to support call protect / private methods. Optimized AnnotationJob to support call protected / private methods. Nov 8, 2025
@limingxinleo limingxinleo merged commit 78fee17 into hyperf:master Nov 8, 2025
74 checks passed
@huangdijia huangdijia deleted the refactor/async-queue-annotation-job branch November 8, 2025 03:22
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