/**
* @param Context $context
* @return boolean|null
*/
public function compile(Context $context)
{
$this->compiled = true;
$context->scopePointer = $this->getPointer();
if ($this->statement->getDocComment() === null) {
$context->notice('missing-docblock', sprintf('Missing docblock for %s() method', $this->name), $this->statement);
}
/**
* It's not needed to compile empty method via it's abstract
*/
if ($this->isAbstract()) {
/** @var ClassDefinition $scope */
$scope = $context->scope;
if (!$scope->isAbstract()) {
$context->notice('not-abstract-class-with-abstract-method', 'Class must be an abstract', $this->statement);
}
return true;
}
if (count($this->statement->stmts) == 0) {
return $context->notice('not-implemented-method', sprintf('Method %s() is not implemented', $this->name), $this->statement);
}
if (count($this->statement->params) > 0) {
/** @var Node\Param $parameter */
foreach ($this->statement->params as $parameter) {
$context->addSymbol($parameter->name);
}
}
foreach ($this->statement->stmts as $st) {
\PHPSA\nodeVisitorFactory($st, $context);
}
}