Skip to content

Commit

Permalink
Use get_class($var) instead of $var::class for php 7.4 support
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Schranz <[email protected]>
  • Loading branch information
alexander-schranz committed Sep 20, 2022
1 parent ed8d13a commit 47d98a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/PlatesEngineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Psr\Container\ContainerInterface;

use function class_exists;
use function get_class;
use function gettype;
use function is_array;
use function is_numeric;
Expand Down Expand Up @@ -173,7 +174,7 @@ private function injectExtension(ContainerInterface $container, PlatesEngine $en
throw new Exception\InvalidExtensionException(sprintf(
'%s expects extension instances, service names, or class names; received %s',
self::class,
is_object($extension) ? $extension::class : gettype($extension)
is_object($extension) ? get_class($extension) : gettype($extension)
));
}

Expand All @@ -194,7 +195,7 @@ private function injectExtension(ContainerInterface $container, PlatesEngine $en
'%s expects extension services to implement %s ; received %s',
self::class,
ExtensionInterface::class,
is_object($extension) ? $extension::class : gettype($extension)
is_object($extension) ? get_class($extension) : gettype($extension)
));
}

Expand Down
5 changes: 3 additions & 2 deletions src/PlatesRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Mezzio\Template\TemplateRendererInterface;
use ReflectionProperty;

use function get_class;
use function gettype;
use function is_object;
use function is_string;
Expand Down Expand Up @@ -94,14 +95,14 @@ public function addDefaultParam(string $templateName, string $param, $value): vo
if (! is_string($templateName) || empty($templateName)) {
throw new Exception\InvalidArgumentException(sprintf(
'$templateName must be a non-empty string; received %s',
is_object($templateName) ? $templateName::class : gettype($templateName)
is_object($templateName) ? get_class($templateName) : gettype($templateName)
));
}

if (! is_string($param) || empty($param)) {
throw new Exception\InvalidArgumentException(sprintf(
'$param must be a non-empty string; received %s',
is_object($param) ? $param::class : gettype($param)
is_object($param) ? get_class($param) : gettype($param)
));
}

Expand Down

0 comments on commit 47d98a8

Please sign in to comment.