PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.5.7
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.5.7
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
code-engine / vendor / nikic / php-parser / lib / PhpParser / Node.php

Node.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.5.7, at vendor/nikic/php-parser/lib/PhpParser/Node.php

150 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace PhpParser;
4
5 interface Node {
6 /**
7 * Gets the type of the node.
8 *
9 * @return string Type of the node
10 */
11 public function getType(): string;
12
13 /**
14 * Gets the names of the sub nodes.
15 *
16 * @return string[] Names of sub nodes
17 */
18 public function getSubNodeNames(): array;
19
20 /**
21 * Gets line the node started in (alias of getStartLine).
22 *
23 * @return int Start line (or -1 if not available)
24 * @phpstan-return -1|positive-int
25 *
26 * @deprecated Use getStartLine() instead
27 */
28 public function getLine(): int;
29
30 /**
31 * Gets line the node started in.
32 *
33 * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default).
34 *
35 * @return int Start line (or -1 if not available)
36 * @phpstan-return -1|positive-int
37 */
38 public function getStartLine(): int;
39
40 /**
41 * Gets the line the node ended in.
42 *
43 * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
44 *
45 * @return int End line (or -1 if not available)
46 * @phpstan-return -1|positive-int
47 */
48 public function getEndLine(): int;
49
50 /**
51 * Gets the token offset of the first token that is part of this node.
52 *
53 * The offset is an index into the array returned by Lexer::getTokens().
54 *
55 * Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default).
56 *
57 * @return int Token start position (or -1 if not available)
58 */
59 public function getStartTokenPos(): int;
60
61 /**
62 * Gets the token offset of the last token that is part of this node.
63 *
64 * The offset is an index into the array returned by Lexer::getTokens().
65 *
66 * Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default).
67 *
68 * @return int Token end position (or -1 if not available)
69 */
70 public function getEndTokenPos(): int;
71
72 /**
73 * Gets the file offset of the first character that is part of this node.
74 *
75 * Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default).
76 *
77 * @return int File start position (or -1 if not available)
78 */
79 public function getStartFilePos(): int;
80
81 /**
82 * Gets the file offset of the last character that is part of this node.
83 *
84 * Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default).
85 *
86 * @return int File end position (or -1 if not available)
87 */
88 public function getEndFilePos(): int;
89
90 /**
91 * Gets all comments directly preceding this node.
92 *
93 * The comments are also available through the "comments" attribute.
94 *
95 * @return Comment[]
96 */
97 public function getComments(): array;
98
99 /**
100 * Gets the doc comment of the node.
101 *
102 * @return null|Comment\Doc Doc comment object or null
103 */
104 public function getDocComment(): ?Comment\Doc;
105
106 /**
107 * Sets the doc comment of the node.
108 *
109 * This will either replace an existing doc comment or add it to the comments array.
110 *
111 * @param Comment\Doc $docComment Doc comment to set
112 */
113 public function setDocComment(Comment\Doc $docComment): void;
114
115 /**
116 * Sets an attribute on a node.
117 *
118 * @param mixed $value
119 */
120 public function setAttribute(string $key, $value): void;
121
122 /**
123 * Returns whether an attribute exists.
124 */
125 public function hasAttribute(string $key): bool;
126
127 /**
128 * Returns the value of an attribute.
129 *
130 * @param mixed $default
131 *
132 * @return mixed
133 */
134 public function getAttribute(string $key, $default = null);
135
136 /**
137 * Returns all the attributes of this node.
138 *
139 * @return array<string, mixed>
140 */
141 public function getAttributes(): array;
142
143 /**
144 * Replaces all the attributes of this node.
145 *
146 * @param array<string, mixed> $attributes
147 */
148 public function setAttributes(array $attributes): void;
149 }
150