From b7afae11bdf274c9cbf167c49949d5303791c6d6 Mon Sep 17 00:00:00 2001 From: Callum Bridgford-Whittick Date: Tue, 11 Aug 2026 16:50:31 +0100 Subject: [PATCH] Docs: Fully qualify the SimplePie cache type in a WP_Feed_Cache_Transient docblock. The `@param` annotation for `$type` in `WP_Feed_Cache_Transient::__construct()` referenced `Base::TYPE_FEED|Base::TYPE_IMAGE`. The class is declared in the global namespace and imports nothing, writing `implements SimplePie\Cache\Base` in full, so the bare `Base` resolved to `\Base`, which does not exist. The annotation was copied from `SimplePie\Cache\Base`, where it is correct because that file declares `namespace SimplePie\Cache;`. Qualifying both constants resolves the reference without changing any behaviour. This was the only `parameter.unresolvableType` occurrence, so the baseline is emptied. The file is removed along with its `includes` entry in `phpstan.neon.dist`. Props CallumBW95. See #65817. --- phpstan.neon.dist | 1 - .../class-wp-feed-cache-transient.php | 8 +++--- .../baselines/parameter.unresolvableType.neon | 25 ------------------- 3 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 tests/phpstan/baselines/parameter.unresolvableType.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3258c2d9c73e8..c9b3b48a67073 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -72,7 +72,6 @@ includes: - tests/phpstan/baselines/parameter.defaultValue.neon - tests/phpstan/baselines/parameter.notFound.neon - tests/phpstan/baselines/parameter.phpDocType.neon - - tests/phpstan/baselines/parameter.unresolvableType.neon - tests/phpstan/baselines/parameterByRef.type.neon - tests/phpstan/baselines/parameterByRef.unusedType.neon - tests/phpstan/baselines/property.defaultValue.neon diff --git a/src/wp-includes/class-wp-feed-cache-transient.php b/src/wp-includes/class-wp-feed-cache-transient.php index 2beeab69d2577..8cb177860b26b 100644 --- a/src/wp-includes/class-wp-feed-cache-transient.php +++ b/src/wp-includes/class-wp-feed-cache-transient.php @@ -50,10 +50,10 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { * @since 3.2.0 Updated to use a PHP5 constructor. * @since 6.7.0 Parameter names have been updated to be in line with the `SimplePie\Cache\Base` interface. * - * @param string $location URL location (scheme is used to determine handler). - * @param string $name Unique identifier for cache object. - * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either `TYPE_FEED` ('spc') for SimplePie data, - * or `TYPE_IMAGE` ('spi') for image data. + * @param string $location URL location (scheme is used to determine handler). + * @param string $name Unique identifier for cache object. + * @param SimplePie\Cache\Base::TYPE_FEED|SimplePie\Cache\Base::TYPE_IMAGE $type Either `TYPE_FEED` ('spc') for SimplePie data, + * or `TYPE_IMAGE` ('spi') for image data. */ public function __construct( $location, $name, $type ) { $this->name = 'feed_' . $name; diff --git a/tests/phpstan/baselines/parameter.unresolvableType.neon b/tests/phpstan/baselines/parameter.unresolvableType.neon deleted file mode 100644 index 1193e163ca555..0000000000000 --- a/tests/phpstan/baselines/parameter.unresolvableType.neon +++ /dev/null @@ -1,25 +0,0 @@ -# PHPStan baseline for the `parameter.unresolvableType` errors in WordPress core. -# -# https://phpstan.org/error-identifiers/parameter.unresolvableType -# -# Each entry is scoped to a single file and carries an exact occurrence count, -# so that a new instance is reported as a new error rather than being absorbed -# silently. Fixing an occurrence therefore means decrementing or removing its -# entry here as part of the same change. -# -# The goal is to empty this file and delete it, along with the `includes` entry -# for it in phpstan.neon.dist. -# -# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with -# -# composer phpstan:baselines -- --identifier=parameter.unresolvableType -# -# which reruns the analysis with this file suppressed so the errors surface again. - -parameters: - ignoreErrors: - - - message: '#^PHPDoc tag @param for parameter \$type contains unresolvable type\.$#' - identifier: parameter.unresolvableType - count: 1 - path: ../../../src/wp-includes/class-wp-feed-cache-transient.php