Skip to content

feat(attribute): Add HasReferrerpolicy trait and referrerpolicy() method to manage referrerpolicy attribute for HTML elements.#38

Merged
terabytesoftw merged 1 commit into
mainfrom
feature_14
Jan 30, 2026
Merged

feat(attribute): Add HasReferrerpolicy trait and referrerpolicy() method to manage referrerpolicy attribute for HTML elements.#38
terabytesoftw merged 1 commit into
mainfrom
feature_14

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

@terabytesoftw terabytesoftw commented Jan 30, 2026

Pull Request

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Summary by CodeRabbit

  • New Features

    • Added support for configuring the HTML referrerpolicy attribute on elements with validation and immutable API.
  • Tests

    • Added comprehensive test coverage for the new referrerpolicy attribute functionality, including validation of valid values and error handling for invalid inputs.

✏️ Tip: You can customize this high-level summary in your review settings.

… method to manage `referrerpolicy` attribute for HTML elements.
@terabytesoftw terabytesoftw added the enhancement New feature or request label Jan 30, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This pull request introduces support for the HTML referrerpolicy attribute through a new trait-based implementation. The changes include a reusable HasReferrerpolicy trait with validation, an addition to the Attribute enum, comprehensive test coverage with a dedicated data provider, and changelog documentation.

Changes

Cohort / File(s) Summary
Attribute Enum Extension
src/Values/Attribute.php
Added REFERRERPOLICY enum case to support the HTML referrerpolicy attribute in the centralized attribute value set.
Trait Implementation
src/HasReferrerpolicy.php
New immutable trait providing referrerpolicy(string|UnitEnum|null $value) method with validation against the Referrerpolicy enum using Validator::oneOf, delegating to addAttribute() for composition.
Test Coverage
tests/HasReferrerpolicyTest.php, tests/Support/Provider/ReferrerpolicyProvider.php
Comprehensive unit test suite covering no-attribute rendering, immutability, valid values (strings and enums), and invalid input exception handling; test data provider aggregates enum cases and manual test scenarios.
Documentation
CHANGELOG.md
Added changelog entry documenting the new HasReferrerpolicy trait and referrerpolicy() method introduction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A trait so fine for referrer's way,
PolicyProvider helps us play,
Validation strong, enums so neat,
Our HTML attributes now complete! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding the HasReferrerpolicy trait and referrerpolicy() method to manage the referrerpolicy attribute, which is directly reflected in all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature_14

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant