Skip to content

feat(attribute): Add HasHrefLang trait and hreflang() method to manage hreflang attribute for HTML elements.#45

Merged
terabytesoftw merged 2 commits into
mainfrom
feature_18
Jan 31, 2026
Merged

feat(attribute): Add HasHrefLang trait and hreflang() method to manage hreflang attribute for HTML elements.#45
terabytesoftw merged 2 commits into
mainfrom
feature_18

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

@terabytesoftw terabytesoftw commented Jan 31, 2026

Pull Request

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

Summary by CodeRabbit

  • New Features

    • Added hreflang attribute support for HTML link-like elements, enabling specification of language variants and alternate content versions to improve SEO and internationalization; supports setting and clearing hreflang values.
  • Tests

    • Added comprehensive, data-driven tests covering various hreflang inputs, rendering outcomes, and edge cases to ensure correct behavior.

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

…anage `hreflang` attribute for HTML elements.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Adds a new immutable HasHreflang trait and hreflang() method, a corresponding HREFLANG enum case, unit tests with a data provider, and a changelog entry documenting the addition.

Changes

Cohort / File(s) Summary
Core Implementation
src/HasHreflang.php, src/Values/Attribute.php
Introduces HasHreflang trait with `hreflang(string
Tests and Test Support
tests/HasHreflangTest.php, tests/Support/Provider/HreflangProvider.php
Adds unit tests verifying immutability, unset/ set behavior, rendering, and a data provider covering empty, null, replacements, and several language codes.
Changelog
CHANGELOG.md
Documents the new trait and method under the 0.5.3 "Under development" section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

enhancement

Poem

🐰 A tiny trait hops in with flair,
hreflang set softly, handled with care.
Immutable hops, attributes tight,
Tests cheer on each language's flight. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.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 PR title correctly describes the main feature: adding a HasHreflang trait and hreflang() method to manage the hreflang attribute. The title is clear, specific, and directly summarizes the primary change in the changeset.

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

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

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.

@terabytesoftw
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 31, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Line 18: Update the changelog entry to match the actual trait name: replace
the incorrect "HasHrefLang" text with "HasHreflang" so it aligns with the trait
defined in src/HasHreflang.php and the hreflang() method; ensure the casing
matches exactly "HasHreflang" wherever referenced in CHANGELOG.md to avoid
confusion.

Comment thread CHANGELOG.md Outdated
@terabytesoftw terabytesoftw merged commit 5e0898f into main Jan 31, 2026
32 checks passed
@terabytesoftw terabytesoftw deleted the feature_18 branch January 31, 2026 12:45
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.

1 participant