Skip to content

Conversation

@tusharnain
Copy link
Contributor

Summary

This pull request adds a missing @return docblock to the defer() global helper defined in Illuminate\Support\functions.php.

The helper returns either a DeferredCallback or a DeferredCallbackCollection, depending on whether a callable is passed. Currently, the docblock does not specify the return type when $callback is null, which can negatively impact IDE autocompletion and static analysis.

Benefits

  • Improves IDE support (e.g., PhpStorm, VS Code)
  • Enhances compatibility with static analysis tools (e.g., PHPStan, Psalm)
  • Clarifies the actual behavior of the helper for future maintainers and contributors
  • Does not introduce any functional changes or side effects

Why This Is Safe

  • This is a docblock-only change; it does not alter runtime behavior.
  • No existing code depends on the absence of the return type in the docblock.

Related

This helper is part of the newer Illuminate\Support\defer() system introduced for deferring callbacks, and this docblock ensures full developer insight into the return behavior of the helper.

Co-authored-by: Sebastian Hädrich <[email protected]>
@taylorotwell taylorotwell merged commit 8e2d286 into laravel:12.x Aug 4, 2025
58 of 60 checks passed
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.

3 participants