qa: replace `get_class()` with `$instance::class`
MODIFY
src/AbstractValidator.php
src/AbstractValidator.php
@@ -9,7 +9,6 @@ use function array_key_exists;
use function array_keys;
use function array_unique;
use function current;
-use function get_class;
use function implode;
use function is_array;
use function is_object;
@@ -330,7 +329,7 @@ abstract class AbstractValidator implements
if (is_object($value)) {
$value = method_exists($value, '__toString')
? (string) $value
- : get_class($value) . ' object';
+ : $value::class . ' object';
} elseif (is_array($value)) {
$value = var_export($value, true);
} else {

MODIFY
src/Barcode.php
src/Barcode.php
@@ -6,7 +6,6 @@ use Traversable;
use function array_key_exists;
use function class_exists;
-use function get_class;
use function gettype;
use function is_array;
use function is_object;
@@ -114,7 +113,7 @@ class Barcode extends AbstractValidator
throw new Exception\InvalidArgumentException(
sprintf(
'Adapter %s does not implement Laminas\\Validator\\Barcode\\AdapterInterface',
- is_object($adapter) ? get_class($adapter) : gettype($adapter)
+ is_object($adapter) ? $adapter::class : gettype($adapter)
)
);
}

MODIFY
src/File/Hash.php
src/File/Hash.php
@@ -10,7 +10,6 @@ use function array_unique;
use function array_values;
use function func_get_arg;
use function func_num_args;
-use function get_class;
use function gettype;
use function hash_algos;
use function hash_file;
@@ -129,7 +128,7 @@ class Hash extends AbstractValidator
if (! is_string($value)) {
throw new Exception\InvalidArgumentException(sprintf(
'Hash must be a string, %s received',
- is_object($value) ? get_class($value) : gettype($value)
+ is_object($value) ? $value::class : gettype($value)
));
}
$this->options['hash'][$value] = $algorithm;

MODIFY
src/Identical.php
src/Identical.php
@@ -7,7 +7,6 @@ use Laminas\Stdlib\ArrayUtils;
use Traversable;
use function array_key_exists;
-use function get_class;
use function gettype;
use function is_array;
use function is_int;
@@ -173,7 +172,7 @@ class Identical extends AbstractValidator
throw new Exception\InvalidArgumentException(sprintf(
'Context passed to %s must be array, ArrayObject or null; received "%s"',
__METHOD__,
- is_object($context) ? get_class($context) : gettype($context)
+ is_object($context) ? $context::class : gettype($context)
));
}

MODIFY
test/TestAsset/Uri/Uri.php
test/TestAsset/Uri/Uri.php
@@ -12,7 +12,6 @@ use function array_intersect_assoc;
use function array_pop;
use function array_unshift;
use function explode;
-use function get_class;
use function gettype;
use function http_build_query;
use function implode;
@@ -182,7 +181,7 @@ class Uri implements UriInterface
} elseif ($uri !== null) {
throw new Exception\InvalidArgumentException(sprintf(
'Expecting a string or a URI object, received "%s"',
- is_object($uri) ? get_class($uri) : gettype($uri)
+ is_object($uri) ? $uri::class : gettype($uri)
));
}
}
@@ -1010,7 +1009,7 @@ class Uri implements UriInterface
if (! is_string($userInfo)) {
throw new Exception\InvalidArgumentException(sprintf(
'Expecting a string, got %s',
- is_object($userInfo) ? get_class($userInfo) : gettype($userInfo)
+ is_object($userInfo) ? $userInfo::class : gettype($userInfo)
));
}
@@ -1036,7 +1035,7 @@ class Uri implements UriInterface
if (! is_string($path)) {
throw new Exception\InvalidArgumentException(sprintf(
'Expecting a string, got %s',
- is_object($path) ? get_class($path) : gettype($path)
+ is_object($path) ? $path::class : gettype($path)
));
}
@@ -1063,7 +1062,7 @@ class Uri implements UriInterface
if (! is_string($input)) {
throw new Exception\InvalidArgumentException(sprintf(
'Expecting a string, got %s',
- is_object($input) ? get_class($input) : gettype($input)
+ is_object($input) ? $input::class : gettype($input)
));
}
@@ -1093,7 +1092,7 @@ class Uri implements UriInterface
if (! is_string($uriString)) {
throw new Exception\InvalidArgumentException(sprintf(
'Expecting a string, got %s',
- is_object($uriString) ? get_class($uriString) : gettype($uriString)
+ is_object($uriString) ? $uriString::class : gettype($uriString)
));
}

MODIFY
test/ValidatorPluginManagerTest.php
test/ValidatorPluginManagerTest.php
@@ -18,7 +18,6 @@ use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use function assert;
-use function get_class;
use function sprintf;
/**
@@ -95,7 +94,7 @@ final class ValidatorPluginManagerTest extends TestCase
} catch (Exception $e) {
self::fail(sprintf(
'Unexpected exception of type "%s" when testing for invalid validator types',
- get_class($e)
+ $e::class
));
}
}
@@ -111,7 +110,7 @@ final class ValidatorPluginManagerTest extends TestCase
} catch (Exception $e) {
self::fail(sprintf(
'Unexpected exception of type "%s" when testing for invalid validator types',
- get_class($e)
+ $e::class
));
}
}

qa: replace `get_class()` with `$instance::class`

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