#62018 closed enhancement (fixed)
HTML API: Satisfy return types in new methods
Reported by: | dlh | Owned by: | dmsnell |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | HTML API | Keywords: | has-patch |
Focuses: | Cc: |
Description
A handful of methods introduced to the HTML API for WordPress 6.7 declare return types but don't return a value in some (improbable) circumstances. The linked PR updates the new methods to return a value in even these cases to avoid generating fatal errors when the return type isn't met.
Change History (5)
This ticket was mentioned in PR #7315 on WordPress/wordpress-develop by @dlh.
4 weeks ago
#1
- Keywords has-patch added
#3
@
4 weeks ago
- Owner set to dmsnell
- Resolution set to fixed
- Status changed from new to closed
In 59001:
#5
@
4 weeks ago
- Milestone changed from Awaiting Review to 6.7
- Type changed from defect (bug) to enhancement
@dlh I reclassified this ticket as an enhancement since the code in question was unreachable. also, while I understand this guards against future breakages to the code, there are no current bugs, and in a sense all code is susceptible to being changed in ways that introduce type errors - this isn't unique the lines changed by this patch.
anyway, thanks for submitting this patch. if you want to explore ways to eliminate the need for it by rearranging code in a way that other tooling can understand, please be invited to do so!
@dlh01 I've updated the comment and called
$this->bail()
in the HTML Processor, which would returnfalse
and bring the notice up for inspection, should someone want to investigate.for the Tag Processor I returned the tag name instead of
null
since it was more in line with what ought to be there.ultimately I'd rather not make these kind of code adjustments, but we already have a few where the tooling is wrong or the code isn't structured in a way that the tooling can understand. if we can rearrange the code so that it's not surprising in these ways that would seem like another nice improvement.