mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-04 22:47:21 +00:00
Make compatible with PHP<8
This commit is contained in:
@@ -19,7 +19,7 @@ use Twig\Util\ReflectionCallable;
|
||||
|
||||
abstract class CallExpression extends AbstractExpression
|
||||
{
|
||||
private ?ReflectionCallable $reflector = null;
|
||||
private $reflector = null;
|
||||
|
||||
protected function compileCallable(Compiler $compiler)
|
||||
{
|
||||
@@ -295,6 +295,10 @@ abstract class CallExpression extends AbstractExpression
|
||||
|
||||
private function reflectCallable($callable): ReflectionCallable
|
||||
{
|
||||
return $this->reflector ??= new ReflectionCallable($callable, $this->getAttribute('type'), $this->getAttribute('name'));
|
||||
if (!$this->reflector) {
|
||||
$this->reflector = new ReflectionCallable($callable, $this->getAttribute('type'), $this->getAttribute('name'));
|
||||
}
|
||||
|
||||
return $this->reflector;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace Twig\Util;
|
||||
*/
|
||||
final class ReflectionCallable
|
||||
{
|
||||
private \ReflectionFunctionAbstract $reflector;
|
||||
private \Closure|string|array|null $callable = null;
|
||||
private string $name;
|
||||
private $reflector;
|
||||
private $callable = null;
|
||||
private $name;
|
||||
|
||||
public function __construct($callable, string $debugType = 'unknown', string $debugName = 'unknown')
|
||||
{
|
||||
@@ -74,7 +74,7 @@ final class ReflectionCallable
|
||||
return $this->reflector;
|
||||
}
|
||||
|
||||
public function getCallable(): \Closure|string|array|null
|
||||
public function getCallable()
|
||||
{
|
||||
return $this->callable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user