當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stmt::__construct方法代碼示例

本文整理匯總了PHP中PhpParser\Node\Stmt::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stmt::__construct方法的具體用法?PHP Stmt::__construct怎麽用?PHP Stmt::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhpParser\Node\Stmt的用法示例。


在下文中一共展示了Stmt::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructs a try catch node.
  *
  * @param Node[]        $stmts      Statements
  * @param Catch_[]      $catches    Catches
  * @param null|Finally_ $finally    Optionaly finally node
  * @param array|null    $attributes Additional attributes
  */
 public function __construct(array $stmts, array $catches, Finally_ $finally = null, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->stmts = $stmts;
     $this->catches = $catches;
     $this->finally = $finally;
 }
開發者ID:nikic,項目名稱:php-parser,代碼行數:15,代碼來源:TryCatch.php

示例2: __construct

 /**
  * Constructs a try catch node.
  *
  * @param Node[]     $stmts        Statements
  * @param Catch_[]   $catches      Catches
  * @param Node[]     $finallyStmts Finally statements (null means no finally clause)
  * @param array|null $attributes   Additional attributes
  */
 public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array())
 {
     if (empty($catches) && null === $finallyStmts) {
         throw new Error('Cannot use try without catch or finally');
     }
     parent::__construct(array('stmts' => $stmts, 'catches' => $catches, 'finallyStmts' => $finallyStmts), $attributes);
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:15,代碼來源:TryCatch.php

示例3: __construct

 /**
  * Constructs a catch node.
  *
  * @param Node\Name $type
  *        	Class of exception
  * @param string $var
  *        	Variable for exception
  * @param Node[] $stmts
  *        	Statements
  * @param array $attributes
  *        	Additional attributes
  */
 public function __construct(Node\Name $type, $var, array $stmts = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->type = $type;
     $this->var = $var;
     $this->stmts = $stmts;
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:19,代碼來源:Catch_.php

示例4: __construct

 /**
  * Constructs a group use node.
  *
  * @param Name $prefix
  *        	Prefix for uses
  * @param UseUse[] $uses
  *        	Uses
  * @param int $type
  *        	Type of group use
  * @param array $attributes
  *        	Additional attributes
  */
 public function __construct(Name $prefix, array $uses, $type = Use_::TYPE_NORMAL, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->type = $type;
     $this->prefix = $prefix;
     $this->uses = $uses;
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:19,代碼來源:GroupUse.php

示例5: __construct

 /**
  * Constructs a class property list node.
  *
  * @param int                $flags      Modifiers
  * @param PropertyProperty[] $props      Properties
  * @param array              $attributes Additional attributes
  */
 public function __construct($flags, array $props, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->flags = $flags;
     $this->type = $flags;
     $this->props = $props;
 }
開發者ID:nikic,項目名稱:php-parser,代碼行數:14,代碼來源:Property.php

示例6: __construct

 /**
  * Constructs a catch node.
  *
  * @param Node\Name[] $types      Types of exceptions to catch
  * @param string      $var        Variable for exception
  * @param Node[]      $stmts      Statements
  * @param array       $attributes Additional attributes
  */
 public function __construct(array $types, $var, array $stmts = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->types = $types;
     $this->var = $var;
     $this->stmts = $stmts;
 }
開發者ID:nikic,項目名稱:php-parser,代碼行數:15,代碼來源:Catch_.php

示例7: __construct

 /**
  * Constructs a for loop node.
  *
  * @param array $subNodes   Array of the following optional subnodes:
  *                          'init'  => array(): Init expressions
  *                          'cond'  => array(): Loop conditions
  *                          'loop'  => array(): Loop expressions
  *                          'stmts' => array(): Statements
  * @param array $attributes Additional attributes
  */
 public function __construct(array $subNodes = array(), array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->init = isset($subNodes['init']) ? $subNodes['init'] : array();
     $this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array();
     $this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array();
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:18,代碼來源:For_.php

示例8: __construct

 /**
  * Constructs a function node.
  *
  * @param string $name       Name
  * @param array  $subNodes   Array of the following optional subnodes:
  *                           'byRef'      => false  : Whether to return by reference
  *                           'params'     => array(): Parameters
  *                           'returnType' => null   : Return type
  *                           'stmts'      => array(): Statements
  * @param array  $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array()) {
     parent::__construct($attributes);
     $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
     $this->name = $name;
     $this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
     $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
 }
開發者ID:nikic,項目名稱:PHP-Parser,代碼行數:19,代碼來源:Function_.php

示例9: __construct

 /**
  * Constructs an if node.
  *
  * @param Node\Expr $cond       Condition
  * @param array     $subNodes   Array of the following optional subnodes:
  *                              'stmts'   => array(): Statements
  *                              'elseifs' => array(): Elseif clauses
  *                              'else'    => null   : Else clause
  * @param array     $attributes Additional attributes
  */
 public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->cond = $cond;
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
     $this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array();
     $this->else = isset($subNodes['else']) ? $subNodes['else'] : null;
 }
開發者ID:qasem2rubik,項目名稱:laravel,代碼行數:18,代碼來源:If_.php

示例10: __construct

 /**
  * Constructs a foreach node.
  *
  * @param Node\Expr $expr
  *        	Expression to iterate
  * @param Node\Expr $valueVar
  *        	Variable to assign value to
  * @param array $subNodes
  *        	Array of the following optional subnodes:
  *        	'keyVar' => null : Variable to assign key to
  *        	'byRef' => false : Whether to assign value by reference
  *        	'stmts' => array(): Statements
  * @param array $attributes
  *        	Additional attributes
  */
 public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->expr = $expr;
     $this->keyVar = isset($subNodes['keyVar']) ? $subNodes['keyVar'] : null;
     $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
     $this->valueVar = $valueVar;
     $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:24,代碼來源:Foreach_.php

示例11: __construct

 /**
  * Constructs a try catch node.
  *
  * @param Node[] $stmts
  *        	Statements
  * @param Catch_[] $catches
  *        	Catches
  * @param null|Node[] $finallyStmts
  *        	Finally statements (null means no finally clause)
  * @param array|null $attributes
  *        	Additional attributes
  */
 public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array())
 {
     if (empty($catches) && null === $finallyStmts) {
         throw new Error('Cannot use try without catch or finally');
     }
     parent::__construct($attributes);
     $this->stmts = $stmts;
     $this->catches = $catches;
     $this->finallyStmts = $finallyStmts;
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:22,代碼來源:TryCatch.php

示例12: __construct

 /**
  * Constructs an alias (use) node.
  *
  * @param Node\Name   $name       Namespace/Class to alias
  * @param null|string $alias      Alias
  * @param int         $type       Type of the use element (for mixed group use declarations only)
  * @param array       $attributes Additional attributes
  */
 public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array())
 {
     if (null === $alias) {
         $alias = $name->getLast();
     }
     parent::__construct($attributes);
     $this->type = $type;
     $this->name = $name;
     $this->alias = $alias;
 }
開發者ID:nikic,項目名稱:php-parser,代碼行數:18,代碼來源:UseUse.php

示例13: __construct

 /**
  * Constructs an alias (use) node.
  *
  * @param Node\Name   $name       Namespace/Class to alias
  * @param null|string $alias      Alias
  * @param array       $attributes Additional attributes
  */
 public function __construct(Node\Name $name, $alias = null, array $attributes = array())
 {
     if (null === $alias) {
         $alias = $name->getLast();
     }
     if ('self' == $alias || 'parent' == $alias) {
         throw new Error(sprintf('Cannot use %s as %s because \'%2$s\' is a special class name', $name, $alias));
     }
     parent::__construct(array('name' => $name, 'alias' => $alias), $attributes);
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:17,代碼來源:UseUse.php

示例14: __construct

 /**
  * Constructs a class property list node.
  *
  * @param int $type
  *        	Modifiers
  * @param PropertyProperty[] $props
  *        	Properties
  * @param array $attributes
  *        	Additional attributes
  */
 public function __construct($type, array $props, array $attributes = array())
 {
     if ($type & Class_::MODIFIER_ABSTRACT) {
         throw new Error('Properties cannot be declared abstract');
     }
     if ($type & Class_::MODIFIER_FINAL) {
         throw new Error('Properties cannot be declared final');
     }
     parent::__construct($attributes);
     $this->type = $type;
     $this->props = $props;
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:22,代碼來源:Property.php

示例15: __construct

 /**
  * Constructs a class node.
  *
  * @param string $name       Name
  * @param array  $subNodes   Array of the following optional subnodes:
  *                           'extends' => array(): Name of extended interfaces
  *                           'stmts'   => array(): Statements
  * @param array  $attributes Additional attributes
  */
 public function __construct($name, array $subNodes = array(), array $attributes = array())
 {
     parent::__construct(array('name' => $name, 'extends' => isset($subNodes['extends']) ? $subNodes['extends'] : array(), 'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array()), $attributes);
     if (isset(self::$specialNames[(string) $this->name])) {
         throw new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $this->name));
     }
     foreach ($this->extends as $interface) {
         if (isset(self::$specialNames[(string) $interface])) {
             throw new Error(sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface));
         }
     }
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:21,代碼來源:Interface_.php


注:本文中的PhpParser\Node\Stmt::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。