Skip to content

Commit

Permalink
qa: switch to ::class from get_class()
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
  • Loading branch information
weierophinney committed Jul 11, 2023
1 parent 977f49a commit 048d542
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/Factory/RestControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
Expand Down
3 changes: 1 addition & 2 deletions src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/ResourceEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/RestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand Down

0 comments on commit 048d542

Please sign in to comment.