function ParserAbstract::checkClassMethod
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ ParserAbstract.php, line 1113
Class
Namespace
PhpParserCode
protected function checkClassMethod(ClassMethod $node, int $modifierPos) : void {
if ($node->flags & Modifiers::STATIC) {
switch ($node->name
->toLowerString()) {
case '__construct':
$this->emitError(new Error(sprintf('Constructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos)));
break;
case '__destruct':
$this->emitError(new Error(sprintf('Destructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos)));
break;
case '__clone':
$this->emitError(new Error(sprintf('Clone method %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos)));
break;
}
}
if ($node->flags & Modifiers::READONLY) {
$this->emitError(new Error(sprintf('Method %s() cannot be readonly', $node->name), $this->getAttributesAt($modifierPos)));
}
}