PHPParser_Node_Stmt_Class::verifyModifier PHP Method

verifyModifier() public static method

public static verifyModifier ( $a, $b )
    public static function verifyModifier($a, $b)
    {
        if ($a & 7 && $b & 7) {
            throw new PHPParser_Error('Multiple access type modifiers are not allowed');
        }
        if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) {
            throw new PHPParser_Error('Multiple abstract modifiers are not allowed');
        }
        if ($a & self::MODIFIER_STATIC && $b & self::MODIFIER_STATIC) {
            throw new PHPParser_Error('Multiple static modifiers are not allowed');
        }
        if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) {
            throw new PHPParser_Error('Multiple final modifiers are not allowed');
        }
        if ($a & 48 && $b & 48) {
            throw new PHPParser_Error('Cannot use the final and abstract modifier at the same time');
        }
    }

Usage Example

Esempio n. 1
0
 /**
  * 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);
 }
All Usage Examples Of PHPParser_Node_Stmt_Class::verifyModifier