Skip to content

Commit

Permalink
chore: Update composer dependencies and use updated lighthouse fork
Browse files Browse the repository at this point in the history
  • Loading branch information
DevDavido committed Nov 9, 2024
1 parent acaa113 commit 92c11d4
Show file tree
Hide file tree
Showing 70 changed files with 1,591 additions and 551 deletions.
2 changes: 1 addition & 1 deletion Lighthouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require PIWIK_INCLUDE_PATH . '/plugins/PerformanceAudit/vendor/autoload.php';

use Dzava\Lighthouse\Lighthouse as BaseLighthouse;
use DevDavido\Lighthouse\Lighthouse as BaseLighthouse;
use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedAuthoriseRefusedException;
use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedException;
use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedMethodNotAllowedException;
Expand Down
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"php": ">=7.2.5",
"ext-json": "*",
"ext-spl": "*",
"ducks-project/spl-types": "^1.2",
"symfony/polyfill-mbstring": "^1.28",
"symfony/process": "^4.4",
"jeroen-g/lighthouse": "^0.2"
"ducks-project/spl-types": "^5.0",
"symfony/polyfill-mbstring": "^1.31",
"symfony/process": "^5.4",
"devdavido/lighthouse": "dev-master#91ddfe4126453d3c9cb4c8263a5238967fbdf9ac"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19"
Expand All @@ -37,5 +37,11 @@
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/devdavido/lighthouse-php"
}
]
}
96 changes: 45 additions & 51 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,66 +45,63 @@ class ClassLoader
/** @var \Closure(string):void */
private static $includeFile;

/** @var ?string */
/** @var string|null */
private $vendorDir;

// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr4 = array();

// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr0 = array();

/** @var bool */
private $useIncludePath = false;

/**
* @var string[]
* @psalm-var array<string, string>
* @var array<string, string>
*/
private $classMap = array();

/** @var bool */
private $classMapAuthoritative = false;

/**
* @var bool[]
* @psalm-var array<string, bool>
* @var array<string, bool>
*/
private $missingClasses = array();

/** @var ?string */
/** @var string|null */
private $apcuPrefix;

/**
* @var self[]
* @var array<string, self>
*/
private static $registeredLoaders = array();

/**
* @param ?string $vendorDir
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
Expand All @@ -113,7 +110,7 @@ public function __construct($vendorDir = null)
}

/**
* @return string[]
* @return array<string, list<string>>
*/
public function getPrefixes()
{
Expand All @@ -125,44 +122,39 @@ public function getPrefixes()
}

/**
* @return array[]
* @psalm-return array<string, array<int, string>>
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}

/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}

/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}

/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}

/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
Expand All @@ -179,24 +171,25 @@ public function addClassMap(array $classMap)
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
$paths
);
}

Expand All @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false)

$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
$this->prefixesPsr0[$first][$prefix] = $paths;

return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
$paths
);
}
}
Expand All @@ -226,27 +219,28 @@ public function add($prefix, $paths, $prepend = false)
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
Expand All @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false)
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
$paths
);
}
}
Expand All @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false)
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
Expand All @@ -294,8 +288,8 @@ public function set($prefix, $paths)
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
Expand Down Expand Up @@ -481,9 +475,9 @@ public function findFile($class)
}

/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return self[]
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
'Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php',
'Composer\\Autoload\\ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c' => $vendorDir . '/composer/autoload_static.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'DevDavido\\Lighthouse\\Exceptions\\AuditFailedException' => $vendorDir . '/devdavido/lighthouse/src/Exceptions/AuditFailedException.php',
'DevDavido\\Lighthouse\\Lighthouse' => $vendorDir . '/devdavido/lighthouse/src/Lighthouse.php',
'DevDavido\\Lighthouse\\Tests\\Integration\\LighthouseTest' => $vendorDir . '/devdavido/lighthouse/tests/Integration/LighthouseTest.php',
'DevDavido\\Lighthouse\\Tests\\Unit\\LighthouseTest' => $vendorDir . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php',
'DevDavido\\Lighthouse\\Tests\\Unit\\MockLighthouse' => $vendorDir . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php',
'Ducks\\Component\\SplTypes\\SplBool' => $vendorDir . '/ducks-project/spl-types/SplBool.php',
'Ducks\\Component\\SplTypes\\SplEnum' => $vendorDir . '/ducks-project/spl-types/SplEnum.php',
'Ducks\\Component\\SplTypes\\SplFloat' => $vendorDir . '/ducks-project/spl-types/SplFloat.php',
'Ducks\\Component\\SplTypes\\SplInt' => $vendorDir . '/ducks-project/spl-types/SplInt.php',
'Ducks\\Component\\SplTypes\\SplString' => $vendorDir . '/ducks-project/spl-types/SplString.php',
'Ducks\\Component\\SplTypes\\SplType' => $vendorDir . '/ducks-project/spl-types/SplType.php',
'Dzava\\Lighthouse\\Exceptions\\AuditFailedException' => $vendorDir . '/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php',
'Dzava\\Lighthouse\\Lighthouse' => $vendorDir . '/jeroen-g/lighthouse/src/Lighthouse.php',
'Dzava\\Lighthouse\\Tests\\Integration\\LighthouseTest' => $vendorDir . '/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php',
'Dzava\\Lighthouse\\Tests\\Unit\\LighthouseTest' => $vendorDir . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php',
'Dzava\\Lighthouse\\Tests\\Unit\\MockLighthouse' => $vendorDir . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php',
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Piwik\\Plugins\\PerformanceAudit\\API' => $baseDir . '/API.php',
'Piwik\\Plugins\\PerformanceAudit\\Archiver' => $baseDir . '/Archiver.php',
Expand Down Expand Up @@ -78,7 +78,7 @@
'Piwik\\Plugins\\PerformanceAudit\\Tasks' => $baseDir . '/Tasks.php',
'Piwik\\Plugins\\PerformanceAudit\\Updates_1_1_0' => $baseDir . '/Updates/1.1.0.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\ApiTest' => $baseDir . '/tests/Integration/ApiTest.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationTest' => $baseDir . '/tests/Integration/PerformanceAuditIntegrationTest.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationPreparation' => $baseDir . '/tests/Integration/PerformanceAuditIntegrationPreparation.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Filter\\AuditScoreClassifierTest' => $baseDir . '/tests/Unit/Filter/AuditScoreClassifierTest.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\PercentTest' => $baseDir . '/tests/Unit/Metric/PercentTest.php',
'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\SecondsTest' => $baseDir . '/tests/Unit/Metric/SecondsTest.php',
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Dzava\\Lighthouse\\' => array($vendorDir . '/jeroen-g/lighthouse/src'),
'Ducks\\Component\\SplTypes\\' => array($vendorDir . '/ducks-project/spl-types'),
'DevDavido\\Lighthouse\\' => array($vendorDir . '/devdavido/lighthouse/src'),
);
Loading

0 comments on commit 92c11d4

Please sign in to comment.