Skip to content

Conversation

@huangdijia
Copy link
Contributor

Summary

This PR consolidates the Htmlable contract usage by migrating from the local FriendsOfHyperf\Support\Contract\Htmlable to the upstream Hyperf\Contract\Htmlable interface. This change reduces code duplication and aligns with Hyperf's core contracts.

Changes

  • ✅ Updated FriendsOfHyperf\Support\Contract\Htmlable to extend Hyperf\Contract\Htmlable
  • ✅ Removed duplicate toHtml() method definition from local contract
  • ✅ Updated imports in MailMessage and SimpleMessage to use Hyperf\Contract\Htmlable
  • ✅ Simplified type hints by removing redundant union types (Htmlable|\Hyperf\ViewEngine\Contract\Htmlable)
  • ✅ Updated HtmlString to implement Hyperf\Contract\Htmlable directly

Benefits

  • Code Simplification: Reduces duplication by leveraging upstream contract
  • Better Compatibility: Aligns with Hyperf's core contract system
  • Cleaner Type Hints: Simplifies type declarations across the codebase
  • Maintainability: Reduces maintenance burden by using framework-provided contracts

Test Plan

  • All existing tests should pass
  • No breaking changes to public API (backward compatible through extension)
  • Type compatibility maintained through interface extension

This change consolidates the Htmlable contract usage by migrating from the local FriendsOfHyperf\Support\Contract\Htmlable to the upstream Hyperf\Contract\Htmlable interface. This reduces code duplication and aligns with Hyperf's core contracts.

Changes:
- Update FriendsOfHyperf\Support\Contract\Htmlable to extend Hyperf\Contract\Htmlable
- Remove duplicate toHtml() method definition
- Update imports in MailMessage and SimpleMessage to use Hyperf\Contract\Htmlable
- Simplify type hints by removing redundant union types
- Update HtmlString to implement Hyperf\Contract\Htmlable directly
@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/use-hyperf-htmlable-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@huangdijia huangdijia changed the base branch from main to 3.2 November 15, 2025 01:38
@huangdijia huangdijia merged commit 54f4984 into 3.2 Nov 15, 2025
4 checks passed
@huangdijia huangdijia deleted the refactor/use-hyperf-htmlable-contract branch November 15, 2025 02:50
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