Fix #221: Throw LogicException in Tag::id() when id is empty string#265
Merged
samdark merged 2 commits intoyiisoft:masterfrom Mar 13, 2026
Merged
Fix #221: Throw LogicException in Tag::id() when id is empty string#265samdark merged 2 commits intoyiisoft:masterfrom
LogicException in Tag::id() when id is empty string#265samdark merged 2 commits intoyiisoft:masterfrom
Conversation
Remove meaningless @psalm-param tag from Tag::id docblock Add CHANGELOG message
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #265 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 829 830 +1
===========================================
Files 89 89
Lines 2229 2231 +2
===========================================
+ Hits 2229 2231 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
samdark
approved these changes
Mar 12, 2026
There was a problem hiding this comment.
Pull request overview
Introduces a backward-incompatible validation to disallow empty-string IDs on tags, aligning Tag::id() with the expectation that HTML id values should be non-empty, and documents the change in the changelog.
Changes:
- Throw a
LogicExceptionfromTag::id()when$id === ''. - Add a unit test asserting
id('')triggers an exception. - Add a changelog entry documenting the BC break.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Tag/Base/Tag.php |
Adds runtime validation and throws LogicException for empty-string IDs. |
tests/Tag/Base/TagTest.php |
Adds a regression test for the new empty-string ID behavior. |
CHANGELOG.md |
Documents the BC change for issue #221. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add @throws LogicException to Tag::id docblock. Update TagTest to expect an empty-string id to throw LogicException with message: The tag id cannot be an empty string.
LogicException in Tag::id() when id is empty string
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue is a bit old, but I hope it's still relevant.