Skip to content

Conversation

@huangdijia
Copy link
Member

Summary

Added @param-closure-this PHPDoc annotation to the Console::command() method to provide better IDE autocomplete and type hinting for the closure's $this context.

Changes

  • Added @param-closure-this \Hyperf\Command\ClosureCommand $command annotation to Console::command() method in src/command/src/Console.php:30
  • This annotation helps IDEs understand that within the closure passed to Console::command(), $this refers to a ClosureCommand instance
  • Improves developer experience with better autocomplete and type safety

Benefits

  • Better IDE support and autocomplete for closures used with Console::command()
  • Clearer documentation of the closure's $this binding
  • No runtime behavior changes - purely documentation improvement

Test plan

  • Verified the annotation syntax is correct
  • No functional changes to test - documentation only

Added `@param-closure-this` PHPDoc annotation to the Console::command() method to provide better IDE autocomplete and type hinting for the closure's $this context, which refers to the ClosureCommand instance.
@limingxinleo limingxinleo merged commit 8c7ee89 into hyperf:master Nov 11, 2025
74 checks passed
@huangdijia huangdijia deleted the docs/add-closure-this-annotation branch November 11, 2025 01:54
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