Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.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\Stmt; | 3 namespace PhpParser\Node\Stmt; |
4 | 4 |
5 use PhpParser\Node; | 5 use PhpParser\Node; |
6 use PhpParser\Node\FunctionLike; | 6 use PhpParser\Node\FunctionLike; |
7 | 7 |
8 /** | |
9 * @property Node\Name $namespacedName Namespaced name (if using NameResolver) | |
10 */ | |
8 class Function_ extends Node\Stmt implements FunctionLike | 11 class Function_ extends Node\Stmt implements FunctionLike |
9 { | 12 { |
10 /** @var bool Whether function returns by reference */ | 13 /** @var bool Whether function returns by reference */ |
11 public $byRef; | 14 public $byRef; |
12 /** @var string Name */ | 15 /** @var Node\Identifier Name */ |
13 public $name; | 16 public $name; |
14 /** @var Node\Param[] Parameters */ | 17 /** @var Node\Param[] Parameters */ |
15 public $params; | 18 public $params; |
16 /** @var null|string|Node\Name|Node\NullableType Return type */ | 19 /** @var null|Node\Identifier|Node\Name|Node\NullableType Return type */ |
17 public $returnType; | 20 public $returnType; |
18 /** @var Node[] Statements */ | 21 /** @var Node\Stmt[] Statements */ |
19 public $stmts; | 22 public $stmts; |
20 | 23 |
21 /** | 24 /** |
22 * Constructs a function node. | 25 * Constructs a function node. |
23 * | 26 * |
24 * @param string $name Name | 27 * @param string|Node\Identifier $name Name |
25 * @param array $subNodes Array of the following optional subnodes: | 28 * @param array $subNodes Array of the following optional subnodes: |
26 * 'byRef' => false : Whether to return by reference | 29 * 'byRef' => false : Whether to return by reference |
27 * 'params' => array(): Parameters | 30 * 'params' => array(): Parameters |
28 * 'returnType' => null : Return type | 31 * 'returnType' => null : Return type |
29 * 'stmts' => array(): Statements | 32 * 'stmts' => array(): Statements |
30 * @param array $attributes Additional attributes | 33 * @param array $attributes Additional attributes |
31 */ | 34 */ |
32 public function __construct($name, array $subNodes = array(), array $attributes = array()) { | 35 public function __construct($name, array $subNodes = [], array $attributes = []) { |
33 parent::__construct($attributes); | 36 parent::__construct($attributes); |
34 $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; | 37 $this->byRef = $subNodes['byRef'] ?? false; |
35 $this->name = $name; | 38 $this->name = \is_string($name) ? new Node\Identifier($name) : $name; |
36 $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); | 39 $this->params = $subNodes['params'] ?? []; |
37 $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; | 40 $returnType = $subNodes['returnType'] ?? null; |
38 $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); | 41 $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; |
42 $this->stmts = $subNodes['stmts'] ?? []; | |
39 } | 43 } |
40 | 44 |
41 public function getSubNodeNames() { | 45 public function getSubNodeNames() : array { |
42 return array('byRef', 'name', 'params', 'returnType', 'stmts'); | 46 return ['byRef', 'name', 'params', 'returnType', 'stmts']; |
43 } | 47 } |
44 | 48 |
45 public function returnsByRef() { | 49 public function returnsByRef() : bool { |
46 return $this->byRef; | 50 return $this->byRef; |
47 } | 51 } |
48 | 52 |
49 public function getParams() { | 53 public function getParams() : array { |
50 return $this->params; | 54 return $this->params; |
51 } | 55 } |
52 | 56 |
53 public function getReturnType() { | 57 public function getReturnType() { |
54 return $this->returnType; | 58 return $this->returnType; |
55 } | 59 } |
56 | 60 |
57 public function getStmts() { | 61 /** @return Node\Stmt[] */ |
62 public function getStmts() : array { | |
58 return $this->stmts; | 63 return $this->stmts; |
59 } | 64 } |
65 | |
66 public function getType() : string { | |
67 return 'Stmt_Function'; | |
68 } | |
60 } | 69 } |