Make WordPress Core


Ignore:
Timestamp:
08/11/2026 05:42:59 PM (7 weeks ago)
Author:
westonruter
Message:

Code Quality: Fully qualify the SimplePie cache type in a docblock.

The @param annotation for $type in WP_Feed_Cache_Transient::__construct() documented the type as Base::TYPE_FEED|Base::TYPE_IMAGE. The class is declared in the global namespace and imports nothing—it writes implements SimplePie\Cache\Base out in full—so the bare Base resolved to \Base, which exists nowhere in core. The shorthand was carried over in r59141 from SimplePie\Cache\Base itself, where it is correct because that file declares namespace SimplePie\Cache;. Qualifying both constants makes the annotation consistent with the rest of the docblock, which already spells the interface out in full.

This was the only parameter.unresolvableType occurrence, so the change empties tests/phpstan/baselines/parameter.unresolvableType.neon. As the baseline header directs, the file is deleted along with its includes entry in phpstan.neon.dist. The baseline was regenerated with:

composer phpstan:baselines -- --identifier=parameter.unresolvableType

Developed in ​https://github.com/WordPress/wordpress-develop/pull/12970.
Follow-up to r59141, r63020.

Props callumbw95.
See #65817.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-feed-cache-transient.php

    r60524 r63181  
    5151         * @since 6.7.0 Parameter names have been updated to be in line with the `SimplePie\Cache\Base` interface.
    5252         *
    53          * @param string                           $location URL location (scheme is used to determine handler).
    54          * @param string                           $name     Unique identifier for cache object.
    55          * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type     Either `TYPE_FEED` ('spc') for SimplePie data,
    56          *                                                   or `TYPE_IMAGE` ('spi') for image data.
     53         * @param string                                                           $location URL location (scheme is used to determine handler).
     54         * @param string                                                           $name     Unique identifier for cache object.
     55         * @param SimplePie\Cache\Base::TYPE_FEED|SimplePie\Cache\Base::TYPE_IMAGE $type     Either `TYPE_FEED` ('spc') for SimplePie data,
     56         *                                                                                   or `TYPE_IMAGE` ('spi') for image data.
    5757         */
    5858        public function __construct( $location, $name, $type ) {
Note: See TracChangeset for help on using the changeset viewer.