Add psalm annotations for `validate($instance)`
MODIFY
src/ValidatorPluginManager.php
src/ValidatorPluginManager.php
@@ -42,7 +42,6 @@ use Zend\Validator\Sitemap\Lastmod;
use Zend\Validator\Sitemap\Loc;
use Zend\Validator\Sitemap\Priority;
-use function get_class;
use function gettype;
use function is_object;
use function method_exists;
@@ -572,6 +571,8 @@ class ValidatorPluginManager extends AbstractPluginManager
* Validate plugin instance
*
* {@inheritDoc}
+ * @param mixed $instance
+ * @psalm-assert InstanceType $instance
*/
public function validate($instance)
{
@@ -580,7 +581,7 @@ class ValidatorPluginManager extends AbstractPluginManager
'%s expects only to create instances of %s; %s is invalid',
static::class,
$this->instanceOf,
- is_object($instance) ? get_class($instance) : gettype($instance)
+ is_object($instance) ? $instance::class : gettype($instance)
));
}
}
@@ -601,7 +602,7 @@ class ValidatorPluginManager extends AbstractPluginManager
} catch (InvalidServiceException $e) {
throw new Exception\RuntimeException(sprintf(
'Plugin of type %s is invalid; must implement %s',
- is_object($plugin) ? get_class($plugin) : gettype($plugin),
+ is_object($plugin) ? $plugin::class : gettype($plugin),
ValidatorInterface::class
), $e->getCode(), $e);
}

Add psalm annotations for `validate($instance)`

Signed-off-by: George Steel <george@net-glue.co.uk>