Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
 
3
namespace PhpParser;
4
 
5
interface Node
6
{
7
    /**
8
     * Gets the type of the node.
9
     *
10
     * @return string Type of the node
11
     */
12
    public function getType() : string;
13
 
14
    /**
15
     * Gets the names of the sub nodes.
16
     *
17
     * @return array Names of sub nodes
18
     */
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;
27
 
28
    /**
29
     * Gets line the node started in.
30
     *
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)
34
     */
35
    public function getStartLine() : int;
36
 
37
    /**
38
     * Gets the line the node ended in.
39
     *
40
     * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
41
     *
42
     * @return int End line (or -1 if not available)
43
     */
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;
94
 
95
    /**
96
     * Gets the doc comment of the node.
97
     *
98
     * @return null|Comment\Doc Doc comment object or null
99
     */
100
    public function getDocComment();
101
 
102
    /**
103
     * Sets the doc comment of the node.
104
     *
105
     * This will either replace an existing doc comment or add it to the comments array.
106
     *
107
     * @param Comment\Doc $docComment Doc comment to set
108
     */
109
    public function setDocComment(Comment\Doc $docComment);
110
 
111
    /**
112
     * Sets an attribute on a node.
113
     *
114
     * @param string $key
115
     * @param mixed  $value
116
     */
117
    public function setAttribute(string $key, $value);
118
 
119
    /**
120
     * Returns whether an attribute exists.
121
     *
122
     * @param string $key
123
     *
124
     * @return bool
125
     */
126
    public function hasAttribute(string $key) : bool;
127
 
128
    /**
129
     * Returns the value of an attribute.
130
     *
131
     * @param string $key
132
     * @param mixed  $default
133
     *
134
     * @return mixed
135
     */
136
    public function getAttribute(string $key, $default = null);
137
 
138
    /**
139
     * Returns all the attributes of this node.
140
     *
141
     * @return array
142
     */
143
    public function getAttributes() : array;
144
 
145
    /**
146
     * Replaces all the attributes of this node.
147
     *
148
     * @param array $attributes
149
     */
150
    public function setAttributes(array $attributes);
151
}