annotate vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 5fb285c0d0e3
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace PhpParser\Node\Expr;
Chris@0 4
Chris@0 5 use PhpParser\Node;
Chris@0 6 use PhpParser\Node\Expr;
Chris@0 7 use PhpParser\Node\FunctionLike;
Chris@0 8
Chris@0 9 class Closure extends Expr implements FunctionLike
Chris@0 10 {
Chris@0 11 /** @var bool Whether the closure is static */
Chris@0 12 public $static;
Chris@0 13 /** @var bool Whether to return by reference */
Chris@0 14 public $byRef;
Chris@0 15 /** @var Node\Param[] Parameters */
Chris@0 16 public $params;
Chris@0 17 /** @var ClosureUse[] use()s */
Chris@0 18 public $uses;
Chris@0 19 /** @var null|string|Node\Name|Node\NullableType Return type */
Chris@0 20 public $returnType;
Chris@0 21 /** @var Node[] Statements */
Chris@0 22 public $stmts;
Chris@0 23
Chris@0 24 /**
Chris@0 25 * Constructs a lambda function node.
Chris@0 26 *
Chris@0 27 * @param array $subNodes Array of the following optional subnodes:
Chris@0 28 * 'static' => false : Whether the closure is static
Chris@0 29 * 'byRef' => false : Whether to return by reference
Chris@0 30 * 'params' => array(): Parameters
Chris@0 31 * 'uses' => array(): use()s
Chris@0 32 * 'returnType' => null : Return type
Chris@0 33 * 'stmts' => array(): Statements
Chris@0 34 * @param array $attributes Additional attributes
Chris@0 35 */
Chris@0 36 public function __construct(array $subNodes = array(), array $attributes = array()) {
Chris@0 37 parent::__construct($attributes);
Chris@0 38 $this->static = isset($subNodes['static']) ? $subNodes['static'] : false;
Chris@0 39 $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
Chris@0 40 $this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
Chris@0 41 $this->uses = isset($subNodes['uses']) ? $subNodes['uses'] : array();
Chris@0 42 $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
Chris@0 43 $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
Chris@0 44 }
Chris@0 45
Chris@0 46 public function getSubNodeNames() {
Chris@0 47 return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts');
Chris@0 48 }
Chris@0 49
Chris@0 50 public function returnsByRef() {
Chris@0 51 return $this->byRef;
Chris@0 52 }
Chris@0 53
Chris@0 54 public function getParams() {
Chris@0 55 return $this->params;
Chris@0 56 }
Chris@0 57
Chris@0 58 public function getReturnType() {
Chris@0 59 return $this->returnType;
Chris@0 60 }
Chris@0 61
Chris@0 62 public function getStmts() {
Chris@0 63 return $this->stmts;
Chris@0 64 }
Chris@0 65 }