fix(mixin); Remove ui-awesome/html-interop from runtime dependencies and keep it as development-only dependency for local tooling/tests.#58
Conversation
…s and keep it as development-only dependency for local tooling/tests.
📝 WalkthroughSummary by CodeRabbit
WalkthroughMoves Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 55 55
===========================================
Files 8 8
Lines 168 168
===========================================
Hits 168 168 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/HasPrefixCollection.php (1)
221-240: 🧹 Nitpick | 🔵 TrivialDocblock example references removed dependency.
Same issue as
HasSuffixCollection: the usage example references\UIAwesome\Html\Interop\Inline::SPAN(line 226), which is now a dev-only dependency. Consider updating to use a project enum.The PHPMD
BooleanArgumentFlagwarning is a false positive for the same reasons as noted inHasSuffixCollection.📝 Suggested docblock update
* Usage example: * ```php - * $component->prefixTag(\UIAwesome\Html\Interop\Inline::SPAN); + * $component->prefixTag(InlineTag::SPAN); * $component->prefixTag(false); * ```🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/HasPrefixCollection.php` around lines 221 - 240, Update the docblock example in the prefixTag method to stop referencing the dev-only external enum (\UIAwesome\Html\Interop\Inline::SPAN) and instead use the project enum (e.g., InlineTag::SPAN) used elsewhere in the codebase; update the example line in the prefixTag docblock and, if appropriate, mirror the same docblock change applied in HasSuffixCollection so both examples are consistent; leave the method signature and behavior (prefixTag(false|UnitEnum $value = false): static) unchanged and ignore the PHPMD BooleanArgumentFlag false positive as noted.src/HasSuffixCollection.php (1)
221-240: 🧹 Nitpick | 🔵 TrivialDocblock example references removed dependency.
The usage example in the docblock still references
\UIAwesome\Html\Interop\Inline::SPAN(line 226), which is now a dev-only dependency. Consider updating the example to use a project enum likeInlineTag::SPANto match the README documentation.Regarding the PHPMD
BooleanArgumentFlagwarning: this is a false positive. Thefalse|UnitEnumunion type is an intentional API design to allow disabling the tag wrapper, which is a valid use case for this fluent API.📝 Suggested docblock update
* Usage example: * ```php - * $component->suffixTag(\UIAwesome\Html\Interop\Inline::SPAN); + * $component->suffixTag(InlineTag::SPAN); * $component->suffixTag(false); * ```🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/HasSuffixCollection.php` around lines 221 - 240, Update the docblock example in the suffixTag method to stop referencing the dev-only \UIAwesome\Html\Interop\Inline enum and use the project enum instead (e.g. InlineTag::SPAN) so docs/README match; leave the method signature and behavior unchanged (suffixTag(false|UnitEnum $value = false): static) because the false|UnitEnum union is an intentional API design and can be ignored as a PHPMD BooleanArgumentFlag false positive. Ensure the docblock example shows both enabling with InlineTag::SPAN and disabling with false, and keep this change localized to the suffixTag docblock.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/HasPrefixCollection.php`:
- Around line 221-240: Update the docblock example in the prefixTag method to
stop referencing the dev-only external enum
(\UIAwesome\Html\Interop\Inline::SPAN) and instead use the project enum (e.g.,
InlineTag::SPAN) used elsewhere in the codebase; update the example line in the
prefixTag docblock and, if appropriate, mirror the same docblock change applied
in HasSuffixCollection so both examples are consistent; leave the method
signature and behavior (prefixTag(false|UnitEnum $value = false): static)
unchanged and ignore the PHPMD BooleanArgumentFlag false positive as noted.
In `@src/HasSuffixCollection.php`:
- Around line 221-240: Update the docblock example in the suffixTag method to
stop referencing the dev-only \UIAwesome\Html\Interop\Inline enum and use the
project enum instead (e.g. InlineTag::SPAN) so docs/README match; leave the
method signature and behavior unchanged (suffixTag(false|UnitEnum $value =
false): static) because the false|UnitEnum union is an intentional API design
and can be ignored as a PHPMD BooleanArgumentFlag false positive. Ensure the
docblock example shows both enabling with InlineTag::SPAN and disabling with
false, and keep this change localized to the suffixTag docblock.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
docs/svgs/features-mobile.svgis excluded by!**/*.svgdocs/svgs/features.svgis excluded by!**/*.svg
📒 Files selected for processing (8)
CHANGELOG.mdREADME.mdUPGRADE.mdcomposer.jsondocs/development.mdsrc/HasContainerCollection.phpsrc/HasPrefixCollection.phpsrc/HasSuffixCollection.php
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: linter / Super Linter
🧰 Additional context used
🪛 PHPMD (2.15.0)
src/HasSuffixCollection.php
[error] 234-234: The method suffixTag has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
src/HasPrefixCollection.php
[error] 234-234: The method prefixTag has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
🔇 Additional comments (9)
CHANGELOG.md (1)
3-5: LGTM! Changelog entry properly documents the breaking change.The version bump to 0.5.0 correctly reflects the breaking change nature of this PR. The entry clearly describes the dependency scope change.
README.md (2)
153-169: LGTM! Clear documentation of the UnitEnum-based tag API.The example effectively demonstrates how users can define their own project enums for tag configuration, removing the runtime dependency on
ui-awesome/html-interopwhile maintaining type safety.
40-40: Installation and documentation links properly updated.The version constraint and upgrade guide link are correctly updated to reflect the 0.5.0 release.
Also applies to: 202-202
UPGRADE.md (1)
1-39: LGTM! Comprehensive upgrade guide for the breaking change.The upgrade documentation clearly explains:
- The runtime dependency removal
- The affected APIs with the new
false|UnitEnumsignature- A practical migration example from interop types to project enums
This will help users migrate smoothly to version 0.5.0.
src/HasContainerCollection.php (1)
34-34: LGTM! Type signature correctly updated tofalse|UnitEnum.The property and method signatures are consistently updated to use the more flexible
UnitEnumtype, allowing users to define their own tag enums without depending onui-awesome/html-interopat runtime.Also applies to: 159-165
src/HasSuffixCollection.php (1)
36-36: LGTM! Type changes consistent with the PR-wide migration.The
suffixTagproperty and getter are correctly updated tofalse|UnitEnum.Also applies to: 100-103
src/HasPrefixCollection.php (1)
36-36: LGTM! Type changes consistent with the PR-wide migration.The
prefixTagproperty and getter are correctly updated tofalse|UnitEnum.Also applies to: 100-103
docs/development.md (1)
5-11: LGTM! Clear documentation of the UnitEnum contract.The new section effectively explains:
- The
UnitEnumshared contract for tag APIs- The removal of
ui-awesome/html-interopas a runtime dependency- Guidance for projects that still want to use interop enums
This complements the UPGRADE.md migration guide well.
composer.json (1)
18-18: > Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/HasSuffixCollection.php`:
- Around line 225-227: Update the docblock example in HasSuffixCollection (the
usage of suffixTag in the PHPDoc) to reference Inline::SPAN instead of the
malformed and removed \UIAwesome\Html\InteropInline::SPAN; locate the example
where suffixTag(...) is shown (matching the suffixTag method examples) and
replace the fully-qualified/misspelled interop reference with the simpler
Inline::SPAN to match HasPrefixCollection's example and current runtime
dependencies.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
src/HasPrefixCollection.phpsrc/HasSuffixCollection.php
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: phpunit / PHP 8.2-ubuntu-latest
- GitHub Check: phpunit / PHP 8.4-windows-2022
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: phpunit / PHP 8.3-windows-2022
- GitHub Check: phpunit / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.4-ubuntu-latest
- GitHub Check: phpunit / PHP 8.1-ubuntu-latest
- GitHub Check: linter / Super Linter
- GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
- GitHub Check: phpstan / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.4-ubuntu-latest
- GitHub Check: linter / Super Linter
🧰 Additional context used
🪛 PHPMD (2.15.0)
src/HasSuffixCollection.php
[error] 234-234: The method suffixTag has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
src/HasPrefixCollection.php
[error] 234-234: The method prefixTag has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
🔇 Additional comments (3)
src/HasPrefixCollection.php (2)
36-36: Type signature changes look correct.The migration from concrete interfaces (
BlockInterface|InlineInterface|VoidInterface) toUnitEnumis appropriate for removing the runtime dependency onui-awesome/html-interop. TheUnitEnumtype is PHP's built-in interface that all enums implement, providing sufficient type safety while allowing flexibility for consumers to define their own tag enums.Also applies to: 98-103
234-234: PHPMD boolean flag warning is a false positive for this pattern.The
false|UnitEnumunion type is a deliberate design choice to allow disabling the tag element. Unlike a generalboolflag that toggles behavior,falsehere is a sentinel value meaning "no tag" whileUnitEnumrepresents a valid tag. This is a common immutable API pattern and not a true SRP violation.src/HasSuffixCollection.php (1)
36-36: Type signature changes are consistent with the prefix trait.The
false|UnitEnumtype for$suffixTagand the corresponding getter correctly mirrors the changes inHasPrefixCollection.php.Also applies to: 98-103
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/HasSuffixCollection.php`:
- Line 234: PHPMD flags the boolean-like parameter in method
suffixTag(false|UnitEnum $value = false) as a "boolean flag" but here false is a
semantic "disabled" sentinel; to silence the analyzer and document intent, add a
docblock for suffixTag explaining that passing false disables the suffix tag and
annotate the parameter type (false|UnitEnum) and either add a PHPMD suppression
annotation (e.g., `@SuppressWarnings`(PHPMD.BooleanArgumentFlag)) or a brief
comment describing the semantic use of false so reviewers and static tools
understand this is intentional.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/HasSuffixCollection.php
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: phpstan / PHP 8.5-ubuntu-latest
- GitHub Check: mutation / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.5-windows-2022
- GitHub Check: phpunit / PHP 8.2-windows-2022
- GitHub Check: phpunit / PHP 8.4-windows-2022
- GitHub Check: phpunit / PHP 8.3-windows-2022
- GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.5-ubuntu-latest
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: phpunit / PHP 8.1-windows-2022
- GitHub Check: phpunit / PHP 8.2-ubuntu-latest
- GitHub Check: composer-require-checker / PHP 8.5-ubuntu-latest
- GitHub Check: linter / Super Linter
- GitHub Check: mutation / PHP 8.5-ubuntu-latest
- GitHub Check: linter / Super Linter
🧰 Additional context used
🪛 PHPMD (2.15.0)
src/HasSuffixCollection.php
[error] 234-234: The method suffixTag has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
🔇 Additional comments (2)
src/HasSuffixCollection.php (2)
36-36: LGTM!The property type change to
false|UnitEnumcorrectly implements the PR objective of removing the interop package dependency while maintaining the ability to disable the tag withfalse.
98-103: LGTM!The getter return type and docblock are correctly updated to match the new
false|UnitEnumproperty type.
Pull Request