/** * Constructs a class property list node. * * @param array $tree Tree * @param int $line Line * @param null|string $docComment Nearest doc comment */ public function __construct(array $tree, $line = -1, $docComment = null) { $modifier = 0; while (is_array($tree[1])) { PHPParser_Node_Stmt_Class::verifyModifier($modifier, $tree[0]); $modifier |= $tree[0]; $tree = $tree[1]; } if (is_int($tree[0])) { PHPParser_Node_Stmt_Class::verifyModifier($modifier, $tree[0]); $modifier |= $tree[0]; } parent::__construct(array('modifier' => $modifier, 'stmts' => isset($tree[1]->stmts) ? $tree[1]->stmts : array($tree)), $line, $docComment); }
/** * validate if the modifier can be added to the current modifiers or not * * @param $modifier * @throws \EBT\ExtensionBuilder\Exception\FileNotFoundException * @throws \EBT\ExtensionBuilder\Exception\SyntaxErrorException */ protected function validateModifier($modifier) { if ($modifier == \PHPParser_Node_Stmt_Class::MODIFIER_FINAL && $this->isAbstract() || $modifier == \PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT && $this->isFinal()) { throw new \EBT\ExtensionBuilder\Exception\SyntaxErrorException('Abstract and Final can\'t be applied both to same object'); } elseif ($modifier == \PHPParser_Node_Stmt_Class::MODIFIER_STATIC && $this->isAbstract() || $modifier == \PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT && $this->isStatic()) { throw new \EBT\ExtensionBuilder\Exception\FileNotFoundException('Abstract and Static can\'t be applied both to same object'); } try { \PHPParser_Node_Stmt_Class::verifyModifier($this->modifiers, $modifier); } catch (\PHPParser_Error $e) { throw new \EBT\ExtensionBuilder\Exception\SyntaxErrorException('Only one access modifier can be applied to one object. Use setModifier to avoid this exception'); } }
protected function yyn166($attributes) { PHPParser_Node_Stmt_Class::verifyModifier($this->yyastk[$this->stackPos - (2 - 1)], $this->yyastk[$this->stackPos - (2 - 2)]); $this->yyval = $this->yyastk[$this->stackPos - (2 - 1)] | $this->yyastk[$this->stackPos - (2 - 2)]; }
protected function yyn142($line, $docComment) { PHPParser_Node_Stmt_Class::verifyModifier($this->yyastk[$this->yysp - (2 - 1)], $this->yyastk[$this->yysp - (2 - 2)]); $this->yyval = $this->yyastk[$this->yysp - (2 - 1)] | $this->yyastk[$this->yysp - (2 - 2)]; }
/** * validate if the modifier can be added to the current modifiers or not * * @param $modifier * @throws Tx_PhpParser_Exception_SyntaxErrorException */ protected function validateModifier($modifier) { if ($modifier == PHPParser_Node_Stmt_Class::MODIFIER_FINAL && $this->isAbstract() || $modifier == PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT && $this->isFinal()) { throw new Tx_PhpParser_Exception_SyntaxErrorException('Abstract and Final can\'t be applied both to same object'); } elseif ($modifier == PHPParser_Node_Stmt_Class::MODIFIER_STATIC && $this->isAbstract() || $modifier == PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT && $this->isStatic()) { throw new Tx_PhpParser_Exception_SyntaxErrorException('Abstract and Static can\'t be applied both to same object'); } try { PHPParser_Node_Stmt_Class::verifyModifier($this->modifiers, $modifier); } catch (Exception $e) { //debug('Error: ' . $e->getMessage(), 'Error'); throw new Tx_PhpParser_Exception_SyntaxErrorException('Only one access modifier can be applied to one object. Use setModifier to avoid this exception'); //return FALSE; } }
/** * Sets a modifier in the $this->type property. * * @param int $modifier Modifier to set */ protected function setModifier($modifier) { PHPParser_Node_Stmt_Class::verifyModifier($this->type, $modifier); $this->type |= $modifier; }