mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-19 13:57:00 +00:00
Use ::class
This commit is contained in:
@@ -122,7 +122,7 @@ final class ExtensionSet
|
||||
|
||||
public function addExtension(ExtensionInterface $extension): void
|
||||
{
|
||||
$class = \get_class($extension);
|
||||
$class = $extension::class;
|
||||
|
||||
if ($this->initialized) {
|
||||
throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class));
|
||||
@@ -330,7 +330,7 @@ final class ExtensionSet
|
||||
|
||||
$extGlobals = $extension->getGlobals();
|
||||
if (!\is_array($extGlobals)) {
|
||||
throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension)));
|
||||
throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', $extension::class));
|
||||
}
|
||||
|
||||
$globals = array_merge($globals, $extGlobals);
|
||||
@@ -466,11 +466,11 @@ final class ExtensionSet
|
||||
// operators
|
||||
if ($operators = $extension->getOperators()) {
|
||||
if (!\is_array($operators)) {
|
||||
throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators)));
|
||||
throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', $extension::class, \is_object($operators) ? $operators::class : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators)));
|
||||
}
|
||||
|
||||
if (2 !== \count($operators)) {
|
||||
throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators)));
|
||||
throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', $extension::class, \count($operators)));
|
||||
}
|
||||
|
||||
$this->unaryOperators = array_merge($this->unaryOperators, $operators[0]);
|
||||
|
||||
Reference in New Issue
Block a user