diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d6e91e4e..97452b36 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1359,6 +1359,9 @@ + + ExtensionManager + Extension\AbstractEntry|Extension\AbstractFeed @@ -1366,6 +1369,11 @@ $this->pluginManager->get($extension) + + + ExtensionPluginManager + + $this->key() @@ -1842,6 +1850,11 @@ trim($responseHtml) trim($string) + + ExtensionManagerInterface + ExtensionManagerInterface + null|ExtensionManagerInterface + ! static::$httpClient gettype($response) @@ -1900,6 +1913,9 @@ + + StandaloneExtensionManager + new $class() @@ -2627,6 +2643,13 @@ + + ?ExtensionManagerInterface + ExtensionManagerInterface + + + ExtensionManager + Extension\AbstractRenderer @@ -2634,6 +2657,11 @@ $this->pluginManager->get($extension) + + + ExtensionPluginManager + + new $renderClass($this) @@ -2769,15 +2797,18 @@ $data['type'] $data['uri'] - + $cat $content $data $data $ext $source + $tidy - + + cleanRepair + parseString render setDomDocument setRootElement @@ -3292,6 +3323,9 @@ + + StandaloneExtensionManager + new $class() @@ -3300,6 +3334,11 @@ + + ExtensionManagerInterface + ExtensionManagerInterface + ExtensionManagerInterface + static::$extensions['entry'] static::$extensions['entryRenderer'] @@ -4843,6 +4882,9 @@ + + CustomExtensionManager + new $class() @@ -5277,6 +5319,9 @@ + + CustomExtensionManager + new $class() diff --git a/src/Reader/ExtensionManager.php b/src/Reader/ExtensionManager.php index 5ace2fd2..e3f06839 100644 --- a/src/Reader/ExtensionManager.php +++ b/src/Reader/ExtensionManager.php @@ -12,6 +12,9 @@ * Default implementation of ExtensionManagerInterface * * Decorator of ExtensionPluginManager. + * + * @final this class wasn't designed to be inherited from, but we can't assume that consumers haven't already + * extended it, therefore we cannot add the final marker without a new major release. */ class ExtensionManager implements ExtensionManagerInterface { @@ -67,9 +70,8 @@ public function get($extension) * Do we have the named extension? * * @param string $extension - * @return bool */ - public function has($extension) + public function has($extension): bool { return $this->pluginManager->has($extension); } diff --git a/src/Reader/ExtensionManagerInterface.php b/src/Reader/ExtensionManagerInterface.php index 4f8f09d1..a9f196c0 100644 --- a/src/Reader/ExtensionManagerInterface.php +++ b/src/Reader/ExtensionManagerInterface.php @@ -4,21 +4,17 @@ namespace Laminas\Feed\Reader; +/** + * This interface exists to provide type inference for container implementations that retrieve extensions. + * Methods have been migrated from declared in PHP to being part of the docblock signature, + * in order to avoid conflicting with `psr/container` signatures, which are way stricter, and + * therefore incompatible with this one. + * + * @deprecated this interface is no longer needed, and shouldn't be relied upon + * + * @method has(string $extension): bool + * @method get(string $extension): mixed + */ interface ExtensionManagerInterface { - /** - * Do we have the extension? - * - * @param string $extension - * @return bool - */ - public function has($extension); - - /** - * Retrieve the extension - * - * @param string $extension - * @return mixed - */ - public function get($extension); } diff --git a/src/Reader/ExtensionPluginManager.php b/src/Reader/ExtensionPluginManager.php index 7bf6a4e3..eab798f2 100644 --- a/src/Reader/ExtensionPluginManager.php +++ b/src/Reader/ExtensionPluginManager.php @@ -24,6 +24,8 @@ * Extension\AbstractFeed. * * @psalm-import-type FactoriesConfigurationType from ConfigInterface + * @final this class wasn't designed to be inherited from, but we can't assume that consumers haven't already + * extended it, therefore we cannot add the final marker without a new major release. */ class ExtensionPluginManager extends AbstractPluginManager implements ExtensionManagerInterface { diff --git a/src/Reader/StandaloneExtensionManager.php b/src/Reader/StandaloneExtensionManager.php index 24a716fd..a37316b1 100644 --- a/src/Reader/StandaloneExtensionManager.php +++ b/src/Reader/StandaloneExtensionManager.php @@ -11,6 +11,10 @@ use function is_string; use function sprintf; +/** + * @final this class wasn't designed to be inherited from, but we can't assume that consumers haven't already + * extended it, therefore we cannot add the final marker without a new major release. + */ class StandaloneExtensionManager implements ExtensionManagerInterface { /** @var array */ @@ -38,9 +42,8 @@ class StandaloneExtensionManager implements ExtensionManagerInterface * Do we have the extension? * * @param string $extension - * @return bool */ - public function has($extension) + public function has($extension): bool { return array_key_exists($extension, $this->extensions); } diff --git a/src/Writer/ExtensionManagerInterface.php b/src/Writer/ExtensionManagerInterface.php index aae9a438..12ec9832 100644 --- a/src/Writer/ExtensionManagerInterface.php +++ b/src/Writer/ExtensionManagerInterface.php @@ -4,21 +4,17 @@ namespace Laminas\Feed\Writer; +/** + * This interface exists to provide type inference for container implementations that retrieve extensions. + * Methods have been migrated from declared in PHP to being part of the docblock signature, + * in order to avoid conflicting with `psr/container` signatures, which are way stricter, and + * therefore incompatible with this one. + * + * @deprecated this interface is no longer needed, and shouldn't be relied upon + * + * @method has(string $extension): bool + * @method get(string $extension): mixed + */ interface ExtensionManagerInterface { - /** - * Do we have the extension? - * - * @param string $extension - * @return bool - */ - public function has($extension); - - /** - * Retrieve the extension - * - * @param string $extension - * @return mixed - */ - public function get($extension); } diff --git a/test/Reader/TestAsset/CustomExtensionManager.php b/test/Reader/TestAsset/CustomExtensionManager.php index 06375445..a2fcabd3 100644 --- a/test/Reader/TestAsset/CustomExtensionManager.php +++ b/test/Reader/TestAsset/CustomExtensionManager.php @@ -12,7 +12,7 @@ /** * Standalone extension manager that omits any extensions added after the 2.9 series. */ -class CustomExtensionManager implements ExtensionManagerInterface +final class CustomExtensionManager implements ExtensionManagerInterface { /** @var array */ private $extensions = [ @@ -35,9 +35,8 @@ class CustomExtensionManager implements ExtensionManagerInterface * Do we have the extension? * * @param string $extension - * @return bool */ - public function has($extension) + public function has($extension): bool { return array_key_exists($extension, $this->extensions); }