PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.7
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/composer/InstalledVersions.php +14 -58 4.0.53.7.7 View file →
@@ -26,25 +26,14 @@
26 26 */
27 27 class InstalledVersions
28 28 {
29 29 /**
30 - * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
31 - * @internal
32 - */
33 - private static $selfDir = null;
34 -
35 - /**
36 30 * @var mixed[]|null
37 - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
31 + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
38 32 */
39 33 private static $installed;
40 34
41 35 /**
42 - * @var bool
43 - */
44 - private static $installedIsLocalDir;
45 -
46 - /**
47 36 * @var bool|null
48 37 */
49 38 private static $canGetVendors;
50 39
@@ -49,9 +38,9 @@
49 38 private static $canGetVendors;
50 39
51 40 /**
52 41 * @var array[]
53 - * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
42 + * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
54 43 */
55 44 private static $installedByVendor = array();
56 45
57 46 /**
@@ -108,9 +97,9 @@
108 97 public static function isInstalled($packageName, $includeDevRequirements = true)
109 98 {
110 99 foreach (self::getInstalled() as $installed) {
111 100 if (isset($installed['versions'][$packageName])) {
112 - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
101 + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
113 102 }
114 103 }
115 104
116 105 return false;
@@ -129,9 +118,9 @@
129 118 * @return bool
130 119 */
131 120 public static function satisfies(VersionParser $parser, $packageName, $constraint)
132 121 {
133 - $constraint = $parser->parseConstraints((string) $constraint);
122 + $constraint = $parser->parseConstraints($constraint);
134 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
135 124
136 125 return $provided->matches($constraint);
137 126 }
@@ -253,9 +242,9 @@
253 242 }
254 243
255 244 /**
256 245 * @return array
257 - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
246 + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
258 247 */
259 248 public static function getRootPackage()
260 249 {
261 250 $installed = self::getInstalled();
@@ -267,9 +256,9 @@
267 256 * Returns the raw installed.php data for custom implementations
268 257 *
269 258 * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
270 259 * @return array[]
271 - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
260 + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
272 261 */
273 262 public static function getRawData()
274 263 {
275 264 @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
@@ -290,9 +279,9 @@
290 279 /**
291 280 * Returns the raw data of all installed.php which are currently loaded for custom implementations
292 281 *
293 282 * @return array[]
294 - * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
283 + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
295 284 */
296 285 public static function getAllRawData()
297 286 {
298 287 return self::getInstalled();
@@ -313,37 +302,19 @@
313 302 *
314 303 * @param array[] $data A vendor/composer/installed.php data set
315 304 * @return void
316 305 *
317 - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
306 + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
318 307 */
319 308 public static function reload($data)
320 309 {
321 310 self::$installed = $data;
322 311 self::$installedByVendor = array();
323 -
324 - // when using reload, we disable the duplicate protection to ensure that self::$installed data is
325 - // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
326 - // so we have to assume it does not, and that may result in duplicate data being returned when listing
327 - // all installed packages for example
328 - self::$installedIsLocalDir = false;
329 312 }
330 313
331 314 /**
332 - * @return string
333 - */
334 - private static function getSelfDir()
335 - {
336 - if (self::$selfDir === null) {
337 - self::$selfDir = strtr(__DIR__, '\\', '/');
338 - }
339 -
340 - return self::$selfDir;
341 - }
342 -
343 - /**
344 315 * @return array[]
345 - * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
316 + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
346 317 */
347 318 private static function getInstalled()
348 319 {
349 320 if (null === self::$canGetVendors) {
@@ -350,29 +321,19 @@
350 321 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
351 322 }
352 323
353 324 $installed = array();
354 - $copiedLocalDir = false;
355 325
356 326 if (self::$canGetVendors) {
357 - $selfDir = self::getSelfDir();
358 327 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
359 - $vendorDir = strtr($vendorDir, '\\', '/');
360 328 if (isset(self::$installedByVendor[$vendorDir])) {
361 329 $installed[] = self::$installedByVendor[$vendorDir];
362 330 } elseif (is_file($vendorDir.'/composer/installed.php')) {
363 - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
364 - $required = require $vendorDir.'/composer/installed.php';
365 - self::$installedByVendor[$vendorDir] = $required;
366 - $installed[] = $required;
367 - if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
368 - self::$installed = $required;
369 - self::$installedIsLocalDir = true;
331 + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
332 + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
333 + self::$installed = $installed[count($installed) - 1];
370 334 }
371 335 }
372 - if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
373 - $copiedLocalDir = true;
374 - }
375 336 }
376 337 }
377 338
378 339 if (null === self::$installed) {
@@ -378,19 +339,14 @@
378 339 if (null === self::$installed) {
379 340 // only require the installed.php file if this file is loaded from its dumped location,
380 341 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
381 342 if (substr(__DIR__, -8, 1) !== 'C') {
382 - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
383 - $required = require __DIR__ . '/installed.php';
384 - self::$installed = $required;
343 + self::$installed = require __DIR__ . '/installed.php';
385 344 } else {
386 345 self::$installed = array();
387 346 }
388 347 }
389 -
390 - if (self::$installed !== array() && !$copiedLocalDir) {
391 - $installed[] = self::$installed;
392 - }
348 + $installed[] = self::$installed;
393 349
394 350 return $installed;
395 351 }
396 352 }