protected function compile($expr, Context $context)
{
$expressionCompiler = $context->getExpressionCompiler();
$leftCE = $expressionCompiler->compile($expr->class);
if ($leftCE->isObject()) {
$name = $expr->name;
/** @var ClassDefinition $classDefinition */
$classDefinition = $context->scope;
if (!$classDefinition->hasMethod($name, true)) {
$context->notice('language_error', sprintf('Static method %s() does not exist in %s scope', $name, $expr->class), $expr);
return new CompiledExpression();
}
$method = $classDefinition->getMethod($name, true);
if ($expr->class->parts[0] !== 'parent' && !$method->isStatic()) {
$context->notice('language_error', sprintf('Method %s() is not static but was called in a static way', $name), $expr);
}
return new CompiledExpression();
}
$context->debug('Unknown static function call', $expr);
return new CompiledExpression();
}