Skip to content

feat(attribute): Add HasAccept, HasAutocomplete traits and accept(), autocomplete() methods to manage accept and autocomplete attributes for HTML elements.#67

Merged
terabytesoftw merged 2 commits into
mainfrom
feature_38
Feb 3, 2026
Merged

feat(attribute): Add HasAccept, HasAutocomplete traits and accept(), autocomplete() methods to manage accept and autocomplete attributes for HTML elements.#67
terabytesoftw merged 2 commits into
mainfrom
feature_38

Conversation

@terabytesoftw
Copy link
Copy Markdown
Contributor

@terabytesoftw terabytesoftw commented Feb 3, 2026

Pull Request

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

Summary by CodeRabbit

Release Notes

  • New Features

    • Added capabilities to manage HTML accept attributes on form elements with an immutable API.
    • Added capabilities to manage HTML autocomplete attributes on form controls with an immutable API.
    • Support for string, Stringable, and enum-backed attribute values.
  • Tests

    • Comprehensive test coverage validates immutability, attribute storage, and HTML rendering behavior.

…t()`, `autocomplete()` methods to manage `accept` and `autocomplete` attributes for HTML elements.
@terabytesoftw terabytesoftw added the enhancement New feature or request label Feb 3, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The PR introduces two new traits (HasAccept, HasAutocomplete) for immutably managing HTML accept and autocomplete attributes on form elements. Each trait provides a fluent method delegating to addAttribute(). Comprehensive tests and data providers validate attribute rendering and immutability behavior.

Changes

Cohort / File(s) Summary
New Trait Implementations
src/HasAccept.php, src/HasAutocomplete.php
Add traits to manage accept and autocomplete attributes immutably via accept() and autocomplete() methods, each delegating to addAttribute().
Trait Unit Tests
tests/HasAcceptTest.php, tests/HasAutocompleteTest.php
Add test classes validating immutability, default rendering behavior, and attribute setting with parameterized data-driven tests.
Test Data Providers
tests/Support/Provider/AcceptProvider.php, tests/Support/Provider/AutocompleteProvider.php
Add data provider classes supplying test cases for accept and autocomplete attributes, covering strings, Stringable, enum values, null, and attribute replacement scenarios.
Documentation
CHANGELOG.md
Add entry documenting introduction of HasAccept and HasAutocomplete traits with accept() and autocomplete() methods.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 New traits hop into the code so clean,
Accept and autocomplete fill the scene!
With fluent methods dancing, immutable and light,
Form elements flow with HTML delight! ✨

🚥 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 changes: introducing two traits (HasAccept, HasAutocomplete) with corresponding methods (accept(), autocomplete()) to manage HTML attributes.

✏️ 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_38

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.

…e an empty string as default value for better handling of autocomplete attribute.
@terabytesoftw
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 3, 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.

@terabytesoftw
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 3, 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.

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