diff --git a/src/Factory/RestControllerFactory.php b/src/Factory/RestControllerFactory.php index 3c21a7a..c4a71b9 100644 --- a/src/Factory/RestControllerFactory.php +++ b/src/Factory/RestControllerFactory.php @@ -21,7 +21,6 @@ use function array_merge; use function array_unique; use function class_exists; -use function get_class; use function gettype; use function in_array; use function is_array; @@ -135,11 +134,11 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $ '%s expects that the "listener" reference a service that implements ' . 'Laminas\EventManager\ListenerAggregateInterface; received %s', __METHOD__, - is_object($listener) ? get_class($listener) : gettype($listener) + is_object($listener) ? $listener::class : gettype($listener) )); } - $resourceIdentifiers = [get_class($listener)]; + $resourceIdentifiers = [$listener::class]; if (isset($config['resource_identifiers'])) { if (! is_array($config['resource_identifiers'])) { $config['resource_identifiers'] = (array) $config['resource_identifiers']; diff --git a/src/Resource.php b/src/Resource.php index a85ffbb..7cac8da 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -24,7 +24,6 @@ use function array_merge; use function array_walk; use function func_get_args; -use function get_class; use function gettype; use function is_array; use function is_bool; @@ -138,7 +137,7 @@ public function setRouteMatch($matches) __METHOD__, RouteMatch::class, V2RouteMatch::class, - is_object($matches) ? get_class($matches) : gettype($matches) + is_object($matches) ? $matches::class : gettype($matches) )); } $this->routeMatch = $matches; diff --git a/src/ResourceEvent.php b/src/ResourceEvent.php index f530856..0e82cd5 100644 --- a/src/ResourceEvent.php +++ b/src/ResourceEvent.php @@ -15,7 +15,6 @@ use Laminas\Stdlib\Parameters; use Laminas\Stdlib\RequestInterface; -use function get_class; use function gettype; use function is_array; use function is_object; @@ -163,7 +162,7 @@ public function setRouteMatch($matches = null) __METHOD__, RouteMatch::class, V2RouteMatch::class, - is_object($matches) ? get_class($matches) : gettype($matches) + is_object($matches) ? $matches::class : gettype($matches) )); } $this->routeMatch = $matches; diff --git a/test/RestControllerTest.php b/test/RestControllerTest.php index da4b695..4abfc33 100644 --- a/test/RestControllerTest.php +++ b/test/RestControllerTest.php @@ -981,7 +981,7 @@ public function testGetListTriggersPreAndPostEvents() $this->assertSame( $collection, $test->collection, - 'Expected ' . get_class($collection) . ', received ' . get_class($test->collection) + 'Expected ' . $collection::class . ', received ' . get_class($test->collection) ); }