[wp-trac] [WordPress Trac] #64238: PHPStan code quality improvements for 7.0
WordPress Trac
noreply at wordpress.org
Tue Mar 3 05:54:10 UTC 2026
#64238: PHPStan code quality improvements for 7.0
--------------------------------------+-------------------------------
Reporter: SergeyBiryukov | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: 7.0
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: coding-standards
--------------------------------------+-------------------------------
Comment (by westonruter):
In [changeset:"61789" 61789]:
{{{
#!CommitTicketReference repository="" revision="61789"
Code Quality: Normalize `object` as type being supplied as comment, post,
site, term, and user.
When constructing these objects, the specific instance type is redundantly
used in a union with a generic `object`. A generic object can be passed
directly from database row result. This also hardens `get_post()` to
account for passing an object that lacks an `ID` property. Similarly,
`sanitize_term()` is hardened to account for an object lacking a `term_id`
property. Comprehensive unit tests are added for `get_post()` and
`sanitize_term()`.
Developed in https://github.com/WordPress/wordpress-develop/pull/11096
Props westonruter, apermo.
See #64238, #64225.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64238#comment:96>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list