PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.1.4
ShopBuilder – WooCommerce Builder For Elementor v1.1.4
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | vendor/composer/ClassLoader.php +55 -53 2.1.111.1.4 View file →
@@ -44,36 +44,37 @@
44 44 {
45 45 /** @var \Closure(string):void */
46 46 private static $includeFile;
47 47
48 - /** @var string|null */
48 + /** @var ?string */
49 49 private $vendorDir;
50 50
51 51 // PSR-4
52 52 /**
53 - * @var array<string, array<string, int>>
53 + * @var array[]
54 + * @psalm-var array<string, array<string, int>>
54 55 */
55 56 private $prefixLengthsPsr4 = array();
56 57 /**
57 - * @var array<string, list<string>>
58 + * @var array[]
59 + * @psalm-var array<string, array<int, string>>
58 60 */
59 61 private $prefixDirsPsr4 = array();
60 62 /**
61 - * @var list<string>
63 + * @var array[]
64 + * @psalm-var array<string, string>
62 65 */
63 66 private $fallbackDirsPsr4 = array();
64 67
65 68 // PSR-0
66 69 /**
67 - * List of PSR-0 prefixes
68 - *
69 - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
70 - *
71 - * @var array<string, array<string, list<string>>>
70 + * @var array[]
71 + * @psalm-var array<string, array<string, string[]>>
72 72 */
73 73 private $prefixesPsr0 = array();
74 74 /**
75 - * @var list<string>
75 + * @var array[]
76 + * @psalm-var array<string, string>
76 77 */
77 78 private $fallbackDirsPsr0 = array();
78 79
79 80 /** @var bool */
@@ -79,9 +80,10 @@
79 80 /** @var bool */
80 81 private $useIncludePath = false;
81 82
82 83 /**
83 - * @var array<string, string>
84 + * @var string[]
85 + * @psalm-var array<string, string>
84 86 */
85 87 private $classMap = array();
86 88
87 89 /** @var bool */
@@ -87,22 +89,23 @@
87 89 /** @var bool */
88 90 private $classMapAuthoritative = false;
89 91
90 92 /**
91 - * @var array<string, bool>
93 + * @var bool[]
94 + * @psalm-var array<string, bool>
92 95 */
93 96 private $missingClasses = array();
94 97
95 - /** @var string|null */
98 + /** @var ?string */
96 99 private $apcuPrefix;
97 100
98 101 /**
99 - * @var array<string, self>
102 + * @var self[]
100 103 */
101 104 private static $registeredLoaders = array();
102 105
103 106 /**
104 - * @param string|null $vendorDir
107 + * @param ?string $vendorDir
105 108 */
106 109 public function __construct($vendorDir = null)
107 110 {
108 111 $this->vendorDir = $vendorDir;
@@ -109,9 +112,9 @@
109 112 self::initializeIncludeClosure();
110 113 }
111 114
112 115 /**
113 - * @return array<string, list<string>>
116 + * @return string[]
114 117 */
115 118 public function getPrefixes()
116 119 {
117 120 if (!empty($this->prefixesPsr0)) {
@@ -121,9 +124,10 @@
121 124 return array();
122 125 }
123 126
124 127 /**
125 - * @return array<string, list<string>>
128 + * @return array[]
129 + * @psalm-return array<string, array<int, string>>
126 130 */
127 131 public function getPrefixesPsr4()
128 132 {
129 133 return $this->prefixDirsPsr4;
@@ -129,9 +133,10 @@
129 133 return $this->prefixDirsPsr4;
130 134 }
131 135
132 136 /**
133 - * @return list<string>
137 + * @return array[]
138 + * @psalm-return array<string, string>
134 139 */
135 140 public function getFallbackDirs()
136 141 {
137 142 return $this->fallbackDirsPsr0;
@@ -137,9 +142,10 @@
137 142 return $this->fallbackDirsPsr0;
138 143 }
139 144
140 145 /**
141 - * @return list<string>
146 + * @return array[]
147 + * @psalm-return array<string, string>
142 148 */
143 149 public function getFallbackDirsPsr4()
144 150 {
145 151 return $this->fallbackDirsPsr4;
@@ -145,9 +151,10 @@
145 151 return $this->fallbackDirsPsr4;
146 152 }
147 153
148 154 /**
149 - * @return array<string, string> Array of classname => path
155 + * @return string[] Array of classname => path
156 + * @psalm-return array<string, string>
150 157 */
151 158 public function getClassMap()
152 159 {
153 160 return $this->classMap;
@@ -153,9 +160,10 @@
153 160 return $this->classMap;
154 161 }
155 162
156 163 /**
157 - * @param array<string, string> $classMap Class to filename map
164 + * @param string[] $classMap Class to filename map
165 + * @psalm-param array<string, string> $classMap
158 166 *
159 167 * @return void
160 168 */
161 169 public function addClassMap(array $classMap)
@@ -170,27 +178,26 @@
170 178 /**
171 179 * Registers a set of PSR-0 directories for a given prefix, either
172 180 * appending or prepending to the ones previously set for this prefix.
173 181 *
174 - * @param string $prefix The prefix
175 - * @param list<string>|string $paths The PSR-0 root directories
176 - * @param bool $prepend Whether to prepend the directories
182 + * @param string $prefix The prefix
183 + * @param string[]|string $paths The PSR-0 root directories
184 + * @param bool $prepend Whether to prepend the directories
177 185 *
178 186 * @return void
179 187 */
180 188 public function add($prefix, $paths, $prepend = false)
181 189 {
182 - $paths = (array) $paths;
183 190 if (!$prefix) {
184 191 if ($prepend) {
185 192 $this->fallbackDirsPsr0 = array_merge(
186 - $paths,
193 + (array) $paths,
187 194 $this->fallbackDirsPsr0
188 195 );
189 196 } else {
190 197 $this->fallbackDirsPsr0 = array_merge(
191 198 $this->fallbackDirsPsr0,
192 - $paths
199 + (array) $paths
193 200 );
194 201 }
195 202
196 203 return;
@@ -197,21 +204,21 @@
197 204 }
198 205
199 206 $first = $prefix[0];
200 207 if (!isset($this->prefixesPsr0[$first][$prefix])) {
201 - $this->prefixesPsr0[$first][$prefix] = $paths;
208 + $this->prefixesPsr0[$first][$prefix] = (array) $paths;
202 209
203 210 return;
204 211 }
205 212 if ($prepend) {
206 213 $this->prefixesPsr0[$first][$prefix] = array_merge(
207 - $paths,
214 + (array) $paths,
208 215 $this->prefixesPsr0[$first][$prefix]
209 216 );
210 217 } else {
211 218 $this->prefixesPsr0[$first][$prefix] = array_merge(
212 219 $this->prefixesPsr0[$first][$prefix],
213 - $paths
220 + (array) $paths
214 221 );
215 222 }
216 223 }
217 224
@@ -218,11 +225,11 @@
218 225 /**
219 226 * Registers a set of PSR-4 directories for a given namespace, either
220 227 * appending or prepending to the ones previously set for this namespace.
221 228 *
222 - * @param string $prefix The prefix/namespace, with trailing '\\'
223 - * @param list<string>|string $paths The PSR-4 base directories
224 - * @param bool $prepend Whether to prepend the directories
229 + * @param string $prefix The prefix/namespace, with trailing '\\'
230 + * @param string[]|string $paths The PSR-4 base directories
231 + * @param bool $prepend Whether to prepend the directories
225 232 *
226 233 * @throws \InvalidArgumentException
227 234 *
228 235 * @return void
@@ -228,20 +235,19 @@
228 235 * @return void
229 236 */
230 237 public function addPsr4($prefix, $paths, $prepend = false)
231 238 {
232 - $paths = (array) $paths;
233 239 if (!$prefix) {
234 240 // Register directories for the root namespace.
235 241 if ($prepend) {
236 242 $this->fallbackDirsPsr4 = array_merge(
237 - $paths,
243 + (array) $paths,
238 244 $this->fallbackDirsPsr4
239 245 );
240 246 } else {
241 247 $this->fallbackDirsPsr4 = array_merge(
242 248 $this->fallbackDirsPsr4,
243 - $paths
249 + (array) $paths
244 250 );
245 251 }
246 252 } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
247 253 // Register directories for a new namespace.
@@ -249,13 +255,13 @@
249 255 if ('\\' !== $prefix[$length - 1]) {
250 256 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
251 257 }
252 258 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
253 - $this->prefixDirsPsr4[$prefix] = $paths;
259 + $this->prefixDirsPsr4[$prefix] = (array) $paths;
254 260 } elseif ($prepend) {
255 261 // Prepend directories for an already registered namespace.
256 262 $this->prefixDirsPsr4[$prefix] = array_merge(
257 - $paths,
263 + (array) $paths,
258 264 $this->prefixDirsPsr4[$prefix]
259 265 );
260 266 } else {
261 267 // Append directories for an already registered namespace.
@@ -260,9 +266,9 @@
260 266 } else {
261 267 // Append directories for an already registered namespace.
262 268 $this->prefixDirsPsr4[$prefix] = array_merge(
263 269 $this->prefixDirsPsr4[$prefix],
264 - $paths
270 + (array) $paths
265 271 );
266 272 }
267 273 }
268 274
@@ -269,10 +275,10 @@
269 275 /**
270 276 * Registers a set of PSR-0 directories for a given prefix,
271 277 * replacing any others previously set for this prefix.
272 278 *
273 - * @param string $prefix The prefix
274 - * @param list<string>|string $paths The PSR-0 base directories
279 + * @param string $prefix The prefix
280 + * @param string[]|string $paths The PSR-0 base directories
275 281 *
276 282 * @return void
277 283 */
278 284 public function set($prefix, $paths)
@@ -287,10 +293,10 @@
287 293 /**
288 294 * Registers a set of PSR-4 directories for a given namespace,
289 295 * replacing any others previously set for this namespace.
290 296 *
291 - * @param string $prefix The prefix/namespace, with trailing '\\'
292 - * @param list<string>|string $paths The PSR-4 base directories
297 + * @param string $prefix The prefix/namespace, with trailing '\\'
298 + * @param string[]|string $paths The PSR-4 base directories
293 299 *
294 300 * @throws \InvalidArgumentException
295 301 *
296 302 * @return void
@@ -422,10 +428,9 @@
422 428 */
423 429 public function loadClass($class)
424 430 {
425 431 if ($file = $this->findFile($class)) {
426 - $includeFile = self::$includeFile;
427 - $includeFile($file);
432 + (self::$includeFile)($file);
428 433
429 434 return true;
430 435 }
431 436
@@ -474,11 +479,11 @@
474 479 return $file;
475 480 }
476 481
477 482 /**
478 - * Returns the currently registered loaders keyed by their corresponding vendor directories.
483 + * Returns the currently registered loaders indexed by their corresponding vendor directories.
479 484 *
480 - * @return array<string, self>
485 + * @return self[]
481 486 */
482 487 public static function getRegisteredLoaders()
483 488 {
484 489 return self::$registeredLoaders;
@@ -554,12 +559,9 @@
554 559
555 560 return false;
556 561 }
557 562
558 - /**
559 - * @return void
560 - */
561 - private static function initializeIncludeClosure()
563 + private static function initializeIncludeClosure(): void
562 564 {
563 565 if (self::$includeFile !== null) {
564 566 return;
565 567 }
@@ -571,9 +573,9 @@
571 573 *
572 574 * @param string $file
573 575 * @return void
574 576 */
575 - self::$includeFile = \Closure::bind(static function($file) {
577 + self::$includeFile = static function($file) {
576 578 include $file;
577 - }, null, null);
579 + };
578 580 }
579 581 }