PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
← All changes | vendor/nikic/php-parser/lib/PhpParser/Node/Name.php +15 -3 3.23.5.9 View file →
@@ -5,9 +5,12 @@
5 5 use PhpParser\NodeAbstract;
6 6
7 7 class Name extends NodeAbstract
8 8 {
9 - /** @var string[] Parts of the name */
9 + /**
10 + * @var string[] Parts of the name
11 + * @deprecated Use getParts() instead
12 + */
10 13 public $parts;
11 14
12 15 private static $specialClassNames = [
13 16 'self' => true,
@@ -30,8 +33,17 @@
30 33 return ['parts'];
31 34 }
32 35
33 36 /**
37 + * Get parts of name (split by the namespace separator).
38 + *
39 + * @return string[] Parts of name
40 + */
41 + public function getParts(): array {
42 + return $this->parts;
43 + }
44 +
45 + /**
34 46 * Gets the first part of the name, i.e. everything before the first namespace separator.
35 47 *
36 48 * @return string First part of the name
37 49 */
@@ -149,9 +161,9 @@
149 161 * @param int|null $length Length of the slice (may be negative)
150 162 *
151 163 * @return static|null Sliced name
152 164 */
153 - public function slice(int $offset, int $length = null) {
165 + public function slice(int $offset, ?int $length = null) {
154 166 $numParts = count($this->parts);
155 167
156 168 $realOffset = $offset < 0 ? $offset + $numParts : $offset;
157 169 if ($realOffset < 0 || $realOffset > $numParts) {
@@ -161,9 +173,9 @@
161 173 if (null === $length) {
162 174 $realLength = $numParts - $realOffset;
163 175 } else {
164 176 $realLength = $length < 0 ? $length + $numParts - $realOffset : $length;
165 - if ($realLength < 0 || $realLength > $numParts) {
177 + if ($realLength < 0 || $realLength > $numParts - $realOffset) {
166 178 throw new \OutOfBoundsException(sprintf('Length %d is out of bounds', $length));
167 179 }
168 180 }
169 181