comparison vendor/nikic/php-parser/lib/PhpParser/Node.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; 3 namespace PhpParser;
4 4
5 interface Node 5 interface Node
6 { 6 {
7 /** 7 /**
8 * Gets the type of the node. 8 * Gets the type of the node.
9 * 9 *
10 * @return string Type of the node 10 * @return string Type of the node
11 */ 11 */
12 public function getType(); 12 public function getType() : string;
13 13
14 /** 14 /**
15 * Gets the names of the sub nodes. 15 * Gets the names of the sub nodes.
16 * 16 *
17 * @return array Names of sub nodes 17 * @return array Names of sub nodes
18 */ 18 */
19 public function getSubNodeNames(); 19 public function getSubNodeNames() : array;
20
21 /**
22 * Gets line the node started in (alias of getStartLine).
23 *
24 * @return int Start line (or -1 if not available)
25 */
26 public function getLine() : int;
20 27
21 /** 28 /**
22 * Gets line the node started in. 29 * Gets line the node started in.
23 * 30 *
24 * @return int Line 31 * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default).
32 *
33 * @return int Start line (or -1 if not available)
25 */ 34 */
26 public function getLine(); 35 public function getStartLine() : int;
27 36
28 /** 37 /**
29 * Sets line the node started in. 38 * Gets the line the node ended in.
30 * 39 *
31 * @param int $line Line 40 * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
32 * 41 *
33 * @deprecated 42 * @return int End line (or -1 if not available)
34 */ 43 */
35 public function setLine($line); 44 public function getEndLine() : int;
45
46 /**
47 * Gets the token offset of the first token that is part of this node.
48 *
49 * The offset is an index into the array returned by Lexer::getTokens().
50 *
51 * Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default).
52 *
53 * @return int Token start position (or -1 if not available)
54 */
55 public function getStartTokenPos() : int;
56
57 /**
58 * Gets the token offset of the last token that is part of this node.
59 *
60 * The offset is an index into the array returned by Lexer::getTokens().
61 *
62 * Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default).
63 *
64 * @return int Token end position (or -1 if not available)
65 */
66 public function getEndTokenPos() : int;
67
68 /**
69 * Gets the file offset of the first character that is part of this node.
70 *
71 * Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default).
72 *
73 * @return int File start position (or -1 if not available)
74 */
75 public function getStartFilePos() : int;
76
77 /**
78 * Gets the file offset of the last character that is part of this node.
79 *
80 * Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default).
81 *
82 * @return int File end position (or -1 if not available)
83 */
84 public function getEndFilePos() : int;
85
86 /**
87 * Gets all comments directly preceding this node.
88 *
89 * The comments are also available through the "comments" attribute.
90 *
91 * @return Comment[]
92 */
93 public function getComments() : array;
36 94
37 /** 95 /**
38 * Gets the doc comment of the node. 96 * Gets the doc comment of the node.
39 * 97 *
40 * The doc comment has to be the last comment associated with the node. 98 * The doc comment has to be the last comment associated with the node.
56 * Sets an attribute on a node. 114 * Sets an attribute on a node.
57 * 115 *
58 * @param string $key 116 * @param string $key
59 * @param mixed $value 117 * @param mixed $value
60 */ 118 */
61 public function setAttribute($key, $value); 119 public function setAttribute(string $key, $value);
62 120
63 /** 121 /**
64 * Returns whether an attribute exists. 122 * Returns whether an attribute exists.
65 * 123 *
66 * @param string $key 124 * @param string $key
67 * 125 *
68 * @return bool 126 * @return bool
69 */ 127 */
70 public function hasAttribute($key); 128 public function hasAttribute(string $key) : bool;
71 129
72 /** 130 /**
73 * Returns the value of an attribute. 131 * Returns the value of an attribute.
74 * 132 *
75 * @param string $key 133 * @param string $key
76 * @param mixed $default 134 * @param mixed $default
77 * 135 *
78 * @return mixed 136 * @return mixed
79 */ 137 */
80 public function &getAttribute($key, $default = null); 138 public function getAttribute(string $key, $default = null);
81 139
82 /** 140 /**
83 * Returns all attributes for the given node. 141 * Returns all the attributes of this node.
84 * 142 *
85 * @return array 143 * @return array
86 */ 144 */
87 public function getAttributes(); 145 public function getAttributes() : array;
146
147 /**
148 * Replaces all the attributes of this node.
149 *
150 * @param array $attributes
151 */
152 public function setAttributes(array $attributes);
88 } 153 }