PHP/TypeCasts: add XML documentation#2738
Open
rodrigoprimo wants to merge 3 commits into
Open
Conversation
61 tasks
ba6e209 to
31462c7
Compare
GaryJones
reviewed
Jun 22, 2026
| > | ||
| <standard> | ||
| <![CDATA[ | ||
| The (float) cast must be used instead of the (double) and (real) casts. The (real) cast was deprecated in PHP 7.4 and removed in PHP 8.0. The (double) cast was deprecated in PHP 8.5. |
Member
There was a problem hiding this comment.
Are the parentheses needed in this English string? The float cast... reads just as well as The (float) cast.... We don't need to demonstrate the syntax for how to cast when talking about casting.
Same applies for title attributes below.
Contributor
Author
There was a problem hiding this comment.
Thanks for your review, @GaryJones. I don't have a strong preference. I went ahead and pushed a new commit applying your suggestion.
GaryJones
approved these changes
Jun 25, 2026
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.
Description
This PR adds XML documentation for the
WordPress.PHP.TypeCastssniff.The documentation is based on the work started by @brentwilson-clariio in #2591. I used the original commits and, in a separate commit, made the changes discussed in the review of #2591, plus I opted to replace the single bulleted standard block with three separate standard blocks, one per error/warning, and context indicating when each cast was deprecated and/or removed from PHP.
Regarding the
(unset)cast, the sniff message suggests usingunset()instead, so I kept that in the documentation from the original PR. But I'm not sure about it, as the behavior is different. As far as I can see,(unset) $areturnsnullwhileunset($a)unsets the variable$a.I suggest squashing the commits before merging. I'm opening the PR without doing that to make it easier to tell my changes apart from the original changes.
Suggested changelog entry
N/A
Related issues/external references
Related to: #1722
Supersedes: #2591
Closes #2591