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


PHP Node\Expr類代碼示例

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


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

示例1: resolve

 /**
  * @param Expr $expr
  *
  * @return array Returns an array of types, or an empty array if the expression doesn't return a value
  */
 public static function resolve(Expr $expr)
 {
     if (!$expr->getAttribute("scope") or !$expr->getAttribute("scopeInner")) {
         throw new \InvalidArgumentException("Expr must have its scope and scopeInner resolved");
     }
     switch (get_class($expr)) {
         default:
             return BasicExpressionReturnTypeResolver::resolve($expr);
     }
 }
開發者ID:sekjun9878,項目名稱:elphp,代碼行數:15,代碼來源:SmartExpressionReturnTypeResolver.php

示例2: __construct

 /**
  * Constructs an array item node.
  *
  * @param Expr $value Value
  * @param null|Expr $key Key
  * @param bool $byRef Whether to assign by reference
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->key = $key;
     $this->value = $value;
     $this->byRef = $byRef;
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:15,代碼來源:ArrayItem.php

示例3: reportArgument

 protected function reportArgument(Expr $arg)
 {
     if ($arg instanceof BinaryOp) {
         $this->reportArgument($arg->left);
         $this->reportArgument($arg->right);
     } elseif ($arg instanceof Encapsed) {
         foreach ($arg->parts as $part) {
             if ($part instanceof Variable) {
                 $this->reportArgument($part);
             }
         }
     } elseif ($arg instanceof Variable) {
         $warn = "Translatable text contains variable '{$arg->name}' on line {$arg->getLine()}, consider using literal string instead.";
         $this->output->writeln("<comment>{$warn}</comment>");
     }
 }
開發者ID:clockworkgeek,項目名稱:magei18n,代碼行數:16,代碼來源:PhpStringFinder.php

示例4: __construct

 /**
  * Constructs a static method call node.
  *
  * @param Node\Name|Expr $class Class name
  * @param string|Expr $name Method name
  * @param Node\Arg[] $args Arguments
  * @param array $attributes Additional attributes
  */
 public function __construct($class, $name, array $args = array(), array $attributes = array())
 {
     parent::__construct($attributes);
     $this->class = $class;
     $this->name = $name;
     $this->args = $args;
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:15,代碼來源:StaticCall.php

示例5: __construct

 /**
  * Constructs a function call node.
  *
  * @param Expr        $var        Variable holding object
  * @param string|Expr $name       Method name
  * @param Arg[]       $args       Arguments
  * @param array       $attributes Additional attributes
  */
 public function __construct(Expr $var, $name, array $args = array(), array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->var = $var;
     $this->name = $name;
     $this->args = $args;
 }
開發者ID:TYPO3,項目名稱:extension_builder,代碼行數:15,代碼來源:MethodCall.php

示例6: __construct

 /**
  * Constructs a ternary operator node.
  *
  * @param Expr      $cond       Condition
  * @param null|Expr $if         Expression for true
  * @param Expr      $else       Expression for false
  * @param array                    $attributes Additional attributes
  */
 public function __construct(Expr $cond, $if, Expr $else, array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->cond = $cond;
     $this->if = $if;
     $this->else = $else;
 }
開發者ID:fakrunt,項目名稱:itmarkerz,代碼行數:15,代碼來源:Ternary.php

示例7: __construct

 /**
  * Constructs a bitwise and node.
  *
  * @param Expr $left The left hand side expression
  * @param Expr $right The right hand side expression
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $left, Expr $right, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->left = $left;
     $this->right = $right;
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:13,代碼來源:BinaryOp.php

示例8: __construct

 /**
  * Constructs an array item node.
  *
  * @param Expr      $value      Value
  * @param null|Expr $key        Key
  * @param bool      $byRef      Whether to assign by reference
  * @param array     $attributes Additional attributes
  */
 public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array())
 {
     parent::__construct(array('key' => $key, 'value' => $value, 'byRef' => $byRef), $attributes);
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:12,代碼來源:ArrayItem.php

示例9: __construct

 /**
  * Constructs an instanceof check node.
  *
  * @param Expr      $expr       Expression
  * @param Name|Expr $class      Class name
  * @param array     $attributes Additional attributes
  */
 public function __construct(Expr $expr, $class, array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->expr = $expr;
     $this->class = $class;
 }
開發者ID:TYPO3,項目名稱:extension_builder,代碼行數:13,代碼來源:Instanceof_.php

示例10: __construct

 /**
  * Constructs an "yield from" node.
  *
  * @param Expr $expr Expression
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $expr, array $attributes = array())
 {
     parent::__construct($attributes);
     $this->expr = $expr;
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:11,代碼來源:YieldFrom.php

示例11: __construct

 /**
  * Constructs an assignment node.
  *
  * @param Expr  $var        Variable
  * @param Expr  $expr       Expression
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $var, Expr $expr, array $attributes = array())
 {
     parent::__construct(array('var' => $var, 'expr' => $expr), $attributes);
 }
開發者ID:samj1912,項目名稱:repo,代碼行數:11,代碼來源:Assign.php

示例12: resolveExpressionValue

 private function resolveExpressionValue(\PhpParser\Node\Expr $expr)
 {
     if ($expr instanceof \PhpParser\Node\Scalar\String_) {
         return array('type' => 'string', 'value' => $expr->getAttribute('originalValue'));
     }
     if ($expr instanceof \PhpParser\Node\Scalar\LNumber || $expr instanceof \PhpParser\Node\Expr\UnaryMinus || $expr instanceof \PhpParser\Node\Expr\UnaryPlus) {
         return array('type' => 'integer', 'value' => $expr->getAttribute('originalValue'));
     }
     if ($expr instanceof \PhpParser\Node\Scalar\DNumber) {
         return array('type' => 'float', 'value' => $expr->getAttribute('originalValue'));
     }
     if ($expr instanceof \PhpParser\Node\Expr\Array_) {
         return array('type' => 'array', 'value' => '');
     }
     if ($expr instanceof \PhpParser\Node\Expr\ClassConstFetch) {
         return array('type' => '{unknown}', 'value' => '', 'constant' => join('\\', $expr->class->parts) . '::' . $expr->name);
     }
     if ($expr instanceof \PhpParser\Node\Expr\ConstFetch) {
         $reference = join('\\', $expr->name->parts);
         if (in_array(strtolower($reference), array('true', 'false'))) {
             return array('type' => 'boolean', 'value' => $reference);
         }
         return array('type' => '{unknown}', 'value' => '', 'constant' => join('\\', $expr->name->parts));
     }
     if ($expr instanceof \PhpParser\Node\Scalar\MagicConst\Line) {
         return array('type' => 'integer', 'value' => '', 'constant' => $expr->getName());
     }
     if ($expr instanceof \PhpParser\Node\Scalar\MagicConst) {
         return array('type' => 'string', 'value' => '', 'constant' => $expr->getName());
     }
     $type = get_class($expr);
     $line = $expr->getLine();
     $file = $this->result->getFileName();
     throw new ParseErrorException("Unexpected expression type '{$type}' for value in line {$line} of file '{$file}'", ParseErrorException::UnexpectedExpr);
 }
開發者ID:theseer,項目名稱:phpdox,代碼行數:35,代碼來源:UnitCollectingVisitor.php

示例13: __construct

 /**
  * Constructs an include node.
  *
  * @param Expr  $expr       Expression
  * @param int   $type       Type of include
  * @param array $attributes Additional attributes
  */
 public function __construct(Expr $expr, $type, array $attributes = array())
 {
     parent::__construct(null, $attributes);
     $this->expr = $expr;
     $this->type = $type;
 }
開發者ID:Ceciceciceci,項目名稱:MySJSU-Class-Registration,代碼行數:13,代碼來源:Include_.php

示例14: __construct

 /**
  * Constructs an instanceof check node.
  *
  * @param Expr      $expr       Expression
  * @param Name|Expr $class      Class name
  * @param array     $attributes Additional attributes
  */
 public function __construct(Expr $expr, $class, array $attributes = array())
 {
     parent::__construct(array('expr' => $expr, 'class' => $class), $attributes);
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:11,代碼來源:Instanceof_.php

示例15: __construct

 /**
  * Constructs an array node.
  *
  * @param Expr[] $vars       Variables
  * @param array  $attributes Additional attributes
  */
 public function __construct(array $vars, array $attributes = array())
 {
     parent::__construct(array('vars' => $vars), $attributes);
 }
開發者ID:Ingothq,項目名稱:multiarmedbandit,代碼行數:10,代碼來源:Isset_.php


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