comparison vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
12:7a779792577d 13:5fb285c0d0e3
1 <?php 1 <?php declare(strict_types=1);
2 2
3 namespace PhpParser\Node\Expr; 3 namespace PhpParser\Node\Expr;
4 4
5 use PhpParser\Node; 5 use PhpParser\Node;
6 use PhpParser\Node\Expr; 6 use PhpParser\Node\Expr;
14 public $byRef; 14 public $byRef;
15 /** @var Node\Param[] Parameters */ 15 /** @var Node\Param[] Parameters */
16 public $params; 16 public $params;
17 /** @var ClosureUse[] use()s */ 17 /** @var ClosureUse[] use()s */
18 public $uses; 18 public $uses;
19 /** @var null|string|Node\Name|Node\NullableType Return type */ 19 /** @var null|Node\Identifier|Node\Name|Node\NullableType Return type */
20 public $returnType; 20 public $returnType;
21 /** @var Node[] Statements */ 21 /** @var Node\Stmt[] Statements */
22 public $stmts; 22 public $stmts;
23 23
24 /** 24 /**
25 * Constructs a lambda function node. 25 * Constructs a lambda function node.
26 * 26 *
31 * 'uses' => array(): use()s 31 * 'uses' => array(): use()s
32 * 'returnType' => null : Return type 32 * 'returnType' => null : Return type
33 * 'stmts' => array(): Statements 33 * 'stmts' => array(): Statements
34 * @param array $attributes Additional attributes 34 * @param array $attributes Additional attributes
35 */ 35 */
36 public function __construct(array $subNodes = array(), array $attributes = array()) { 36 public function __construct(array $subNodes = [], array $attributes = []) {
37 parent::__construct($attributes); 37 parent::__construct($attributes);
38 $this->static = isset($subNodes['static']) ? $subNodes['static'] : false; 38 $this->static = $subNodes['static'] ?? false;
39 $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; 39 $this->byRef = $subNodes['byRef'] ?? false;
40 $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); 40 $this->params = $subNodes['params'] ?? [];
41 $this->uses = isset($subNodes['uses']) ? $subNodes['uses'] : array(); 41 $this->uses = $subNodes['uses'] ?? [];
42 $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; 42 $returnType = $subNodes['returnType'] ?? null;
43 $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); 43 $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
44 $this->stmts = $subNodes['stmts'] ?? [];
44 } 45 }
45 46
46 public function getSubNodeNames() { 47 public function getSubNodeNames() : array {
47 return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts'); 48 return ['static', 'byRef', 'params', 'uses', 'returnType', 'stmts'];
48 } 49 }
49 50
50 public function returnsByRef() { 51 public function returnsByRef() : bool {
51 return $this->byRef; 52 return $this->byRef;
52 } 53 }
53 54
54 public function getParams() { 55 public function getParams() : array {
55 return $this->params; 56 return $this->params;
56 } 57 }
57 58
58 public function getReturnType() { 59 public function getReturnType() {
59 return $this->returnType; 60 return $this->returnType;
60 } 61 }
61 62
62 public function getStmts() { 63 /** @return Node\Stmt[] */
64 public function getStmts() : array {
63 return $this->stmts; 65 return $this->stmts;
64 } 66 }
67
68 public function getType() : string {
69 return 'Expr_Closure';
70 }
65 } 71 }