mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 00:10:51 +00:00
Updated Rector to commit fa8e59708b
fa8e59708b
Use local version resolver (#36)
This commit is contained in:
parent
df00621605
commit
4c713c78de
|
@ -42,11 +42,6 @@ try {
|
|||
$symfonyStyle->error($throwable->getMessage());
|
||||
exit(\RectorPrefix20210514\Symplify\PackageBuilder\Console\ShellCode::ERROR);
|
||||
}
|
||||
// preload local InstalledVersions.php - to fix incorrect version by same-named class in phpstan
|
||||
$currentlyInstalledVersions = __DIR__ . '/../../../../vendor/composer/InstalledVersions.php';
|
||||
if (\file_exists($currentlyInstalledVersions)) {
|
||||
require_once $currentlyInstalledVersions;
|
||||
}
|
||||
/** @var ConsoleApplication $application */
|
||||
$application = $container->get(\Rector\Core\Console\ConsoleApplication::class);
|
||||
exit($application->run());
|
||||
|
|
|
@ -39,7 +39,7 @@ final class JsonOutputFormatter implements \Rector\ChangesReporting\Contract\Out
|
|||
}
|
||||
public function report(\Rector\Core\ValueObject\ProcessResult $processResult) : void
|
||||
{
|
||||
$errorsArray = ['meta' => ['version' => $this->configuration->getPrettyVersion(), 'config' => $this->configuration->getMainConfigFilePath()], 'totals' => ['changed_files' => \count($processResult->getFileDiffs()), 'removed_and_added_files_count' => $processResult->getRemovedAndAddedFilesCount(), 'removed_node_count' => $processResult->getRemovedNodeCount()]];
|
||||
$errorsArray = ['meta' => ['config' => $this->configuration->getMainConfigFilePath()], 'totals' => ['changed_files' => \count($processResult->getFileDiffs()), 'removed_and_added_files_count' => $processResult->getRemovedAndAddedFilesCount(), 'removed_node_count' => $processResult->getRemovedNodeCount()]];
|
||||
$fileDiffs = $processResult->getFileDiffs();
|
||||
\ksort($fileDiffs);
|
||||
foreach ($fileDiffs as $fileDiff) {
|
||||
|
|
46
src/Application/VersionResolver.php
Normal file
46
src/Application/VersionResolver.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Core\Application;
|
||||
|
||||
use RectorPrefix20210514\Composer\InstalledVersions;
|
||||
use RectorPrefix20210514\Nette\Utils\Strings;
|
||||
/**
|
||||
* Inspired by https://github.com/symplify/symplify/pull/3179/files
|
||||
* Local resolver is needed, because PHPStan is unprefixing its InstalledVersion classes and the API is changing way too often.
|
||||
* This makes sure it works without dependency on external conditions.
|
||||
*/
|
||||
final class VersionResolver
|
||||
{
|
||||
public function resolve() : string
|
||||
{
|
||||
// give local IntalledVersions a priority above anything else
|
||||
$intalledVersionsFilepath = __DIR__ . '/../../vendor/composer/InstalledVersions.php';
|
||||
if (\file_exists($intalledVersionsFilepath)) {
|
||||
require_once $intalledVersionsFilepath;
|
||||
}
|
||||
$installedRawData = \RectorPrefix20210514\Composer\InstalledVersions::getRawData();
|
||||
$rectorPackageData = $this->resolvePackageData($installedRawData);
|
||||
if ($rectorPackageData === null) {
|
||||
return 'Unknown';
|
||||
}
|
||||
if (isset($rectorPackageData['replaced'])) {
|
||||
return 'replaced@' . $rectorPackageData['replaced'][0];
|
||||
}
|
||||
if ($rectorPackageData['version'] === 'dev-main') {
|
||||
$reference = $rectorPackageData['reference'] ?? null;
|
||||
if ($reference === null) {
|
||||
return 'dev-main';
|
||||
}
|
||||
return 'dev-main@' . \RectorPrefix20210514\Nette\Utils\Strings::substring($rectorPackageData['reference'], 0, 7);
|
||||
}
|
||||
return $rectorPackageData['version'];
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $installedRawData
|
||||
*/
|
||||
private function resolvePackageData(array $installedRawData) : ?array
|
||||
{
|
||||
return $installedRawData['versions']['rector/rector-src'] ?? $installedRawData['versions']['rector/rector'] ?? $installedRawData['root'] ?? null;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Core\Configuration;
|
||||
|
||||
use RectorPrefix20210514\Jean85\PrettyVersions;
|
||||
use RectorPrefix20210514\Nette\Utils\Strings;
|
||||
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
|
||||
use Rector\Core\Exception\Configuration\InvalidConfigurationException;
|
||||
|
@ -89,11 +88,6 @@ final class Configuration
|
|||
$this->paths = $commandLinePaths;
|
||||
}
|
||||
}
|
||||
public function getPrettyVersion() : string
|
||||
{
|
||||
$version = \RectorPrefix20210514\Jean85\PrettyVersions::getVersion('rector/rector');
|
||||
return $version->getPrettyVersion();
|
||||
}
|
||||
/**
|
||||
* @forTests
|
||||
*/
|
||||
|
|
|
@ -4,9 +4,8 @@ declare (strict_types=1);
|
|||
namespace Rector\Core\Console;
|
||||
|
||||
use RectorPrefix20210514\Composer\XdebugHandler\XdebugHandler;
|
||||
use OutOfBoundsException;
|
||||
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
|
||||
use Rector\Core\Configuration\Configuration;
|
||||
use Rector\Core\Application\VersionResolver;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\Command\ProcessCommand;
|
||||
use Rector\Core\Exception\Configuration\InvalidConfigurationException;
|
||||
|
@ -26,13 +25,9 @@ final class ConsoleApplication extends \RectorPrefix20210514\Symfony\Component\C
|
|||
/**
|
||||
* @param Command[] $commands
|
||||
*/
|
||||
public function __construct(\Rector\Core\Configuration\Configuration $configuration, \RectorPrefix20210514\Symplify\PackageBuilder\Console\Command\CommandNaming $commandNaming, array $commands = [])
|
||||
public function __construct(\Rector\Core\Application\VersionResolver $versionResolver, \RectorPrefix20210514\Symplify\PackageBuilder\Console\Command\CommandNaming $commandNaming, array $commands = [])
|
||||
{
|
||||
try {
|
||||
$version = $configuration->getPrettyVersion();
|
||||
} catch (\OutOfBoundsException $exception) {
|
||||
$version = 'Unknown';
|
||||
}
|
||||
$version = $versionResolver->resolve();
|
||||
parent::__construct(self::NAME, $version);
|
||||
foreach ($commands as $command) {
|
||||
$commandName = $commandNaming->resolveFromCommand($command);
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d::getLoader();
|
||||
return ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa::getLoader();
|
||||
|
|
2
vendor/composer/InstalledVersions.php
vendored
2
vendor/composer/InstalledVersions.php
vendored
File diff suppressed because one or more lines are too long
6
vendor/composer/autoload_classmap.php
vendored
6
vendor/composer/autoload_classmap.php
vendored
|
@ -393,8 +393,6 @@ return array(
|
|||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\EditorConfigFile' => $vendorDir . '/idiosyncratic/editorconfig/src/EditorConfigFile.php',
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\Exception\\InvalidValue' => $vendorDir . '/idiosyncratic/editorconfig/src/Exception/InvalidValue.php',
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\Section' => $vendorDir . '/idiosyncratic/editorconfig/src/Section.php',
|
||||
'RectorPrefix20210514\\Jean85\\PrettyVersions' => $vendorDir . '/jean85/pretty-package-versions/src/PrettyVersions.php',
|
||||
'RectorPrefix20210514\\Jean85\\Version' => $vendorDir . '/jean85/pretty-package-versions/src/Version.php',
|
||||
'RectorPrefix20210514\\Nette\\ArgumentOutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210514\\Nette\\Bridges\\CacheDI\\CacheExtension' => $vendorDir . '/nette/caching/src/Bridges/CacheDI/CacheExtension.php',
|
||||
'RectorPrefix20210514\\Nette\\Bridges\\CacheLatte\\CacheMacro' => $vendorDir . '/nette/caching/src/Bridges/CacheLatte/CacheMacro.php',
|
||||
|
@ -462,9 +460,6 @@ return array(
|
|||
'RectorPrefix20210514\\Nette\\Utils\\UnknownImageFileException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php',
|
||||
'RectorPrefix20210514\\Nette\\Utils\\Validators' => $vendorDir . '/nette/utils/src/Utils/Validators.php',
|
||||
'RectorPrefix20210514\\Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\FallbackVersions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\Installer' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\Versions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php',
|
||||
'RectorPrefix20210514\\PrettyXml\\Formatter' => $vendorDir . '/shanethehat/pretty-xml/src/PrettyXml/Formatter.php',
|
||||
'RectorPrefix20210514\\Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php',
|
||||
'RectorPrefix20210514\\Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php',
|
||||
|
@ -1693,6 +1688,7 @@ return array(
|
|||
'Rector\\Core\\Application\\FileProcessor\\PhpFileProcessor' => $baseDir . '/src/Application/FileProcessor/PhpFileProcessor.php',
|
||||
'Rector\\Core\\Application\\FileSystem\\RemovedAndAddedFilesCollector' => $baseDir . '/src/Application/FileSystem/RemovedAndAddedFilesCollector.php',
|
||||
'Rector\\Core\\Application\\FileSystem\\RemovedAndAddedFilesProcessor' => $baseDir . '/src/Application/FileSystem/RemovedAndAddedFilesProcessor.php',
|
||||
'Rector\\Core\\Application\\VersionResolver' => $baseDir . '/src/Application/VersionResolver.php',
|
||||
'Rector\\Core\\Autoloading\\AdditionalAutoloader' => $baseDir . '/src/Autoloading/AdditionalAutoloader.php',
|
||||
'Rector\\Core\\Autoloading\\BootstrapFilesIncluder' => $baseDir . '/src/Autoloading/BootstrapFilesIncluder.php',
|
||||
'Rector\\Core\\Bootstrap\\ExtensionConfigResolver' => $baseDir . '/src/Bootstrap/ExtensionConfigResolver.php',
|
||||
|
|
2
vendor/composer/autoload_psr4.php
vendored
2
vendor/composer/autoload_psr4.php
vendored
|
@ -58,8 +58,6 @@ return array(
|
|||
'RectorPrefix20210514\\Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
|
||||
'RectorPrefix20210514\\Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'RectorPrefix20210514\\PrettyXml\\' => array($vendorDir . '/shanethehat/pretty-xml/src/PrettyXml'),
|
||||
'RectorPrefix20210514\\PackageVersions\\' => array($vendorDir . '/composer/package-versions-deprecated/src/PackageVersions'),
|
||||
'RectorPrefix20210514\\Jean85\\' => array($vendorDir . '/jean85/pretty-package-versions/src'),
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\' => array($vendorDir . '/idiosyncratic/editorconfig/src'),
|
||||
'RectorPrefix20210514\\Ergebnis\\Json\\Printer\\' => array($vendorDir . '/ergebnis/json-printer/src'),
|
||||
'RectorPrefix20210514\\Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'),
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
||||
class ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire4fc2c55889d3d94c2b1d3f0602fe6e7d($fileIdentifier, $file);
|
||||
composerRequiref6d96ea7adfab7704dfa6631d285d1fa($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire4fc2c55889d3d94c2b1d3f0602fe6e7d($fileIdentifier, $file)
|
||||
function composerRequiref6d96ea7adfab7704dfa6631d285d1fa($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
24
vendor/composer/autoload_static.php
vendored
24
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
||||
class ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -82,8 +82,6 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
'RectorPrefix20210514\\Psr\\EventDispatcher\\' => 41,
|
||||
'RectorPrefix20210514\\Psr\\Container\\' => 35,
|
||||
'RectorPrefix20210514\\PrettyXml\\' => 31,
|
||||
'RectorPrefix20210514\\PackageVersions\\' => 37,
|
||||
'RectorPrefix20210514\\Jean85\\' => 28,
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\' => 48,
|
||||
'RectorPrefix20210514\\Ergebnis\\Json\\Printer\\' => 43,
|
||||
'RectorPrefix20210514\\Doctrine\\Inflector\\' => 40,
|
||||
|
@ -308,14 +306,6 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
array (
|
||||
0 => __DIR__ . '/..' . '/shanethehat/pretty-xml/src/PrettyXml',
|
||||
),
|
||||
'RectorPrefix20210514\\PackageVersions\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions',
|
||||
),
|
||||
'RectorPrefix20210514\\Jean85\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/jean85/pretty-package-versions/src',
|
||||
),
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src',
|
||||
|
@ -738,8 +728,6 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\EditorConfigFile' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/EditorConfigFile.php',
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\Exception\\InvalidValue' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/Exception/InvalidValue.php',
|
||||
'RectorPrefix20210514\\Idiosyncratic\\EditorConfig\\Section' => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src/Section.php',
|
||||
'RectorPrefix20210514\\Jean85\\PrettyVersions' => __DIR__ . '/..' . '/jean85/pretty-package-versions/src/PrettyVersions.php',
|
||||
'RectorPrefix20210514\\Jean85\\Version' => __DIR__ . '/..' . '/jean85/pretty-package-versions/src/Version.php',
|
||||
'RectorPrefix20210514\\Nette\\ArgumentOutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php',
|
||||
'RectorPrefix20210514\\Nette\\Bridges\\CacheDI\\CacheExtension' => __DIR__ . '/..' . '/nette/caching/src/Bridges/CacheDI/CacheExtension.php',
|
||||
'RectorPrefix20210514\\Nette\\Bridges\\CacheLatte\\CacheMacro' => __DIR__ . '/..' . '/nette/caching/src/Bridges/CacheLatte/CacheMacro.php',
|
||||
|
@ -807,9 +795,6 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
'RectorPrefix20210514\\Nette\\Utils\\UnknownImageFileException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php',
|
||||
'RectorPrefix20210514\\Nette\\Utils\\Validators' => __DIR__ . '/..' . '/nette/utils/src/Utils/Validators.php',
|
||||
'RectorPrefix20210514\\Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\FallbackVersions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\Installer' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php',
|
||||
'RectorPrefix20210514\\PackageVersions\\Versions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php',
|
||||
'RectorPrefix20210514\\PrettyXml\\Formatter' => __DIR__ . '/..' . '/shanethehat/pretty-xml/src/PrettyXml/Formatter.php',
|
||||
'RectorPrefix20210514\\Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php',
|
||||
'RectorPrefix20210514\\Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php',
|
||||
|
@ -2038,6 +2023,7 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
'Rector\\Core\\Application\\FileProcessor\\PhpFileProcessor' => __DIR__ . '/../..' . '/src/Application/FileProcessor/PhpFileProcessor.php',
|
||||
'Rector\\Core\\Application\\FileSystem\\RemovedAndAddedFilesCollector' => __DIR__ . '/../..' . '/src/Application/FileSystem/RemovedAndAddedFilesCollector.php',
|
||||
'Rector\\Core\\Application\\FileSystem\\RemovedAndAddedFilesProcessor' => __DIR__ . '/../..' . '/src/Application/FileSystem/RemovedAndAddedFilesProcessor.php',
|
||||
'Rector\\Core\\Application\\VersionResolver' => __DIR__ . '/../..' . '/src/Application/VersionResolver.php',
|
||||
'Rector\\Core\\Autoloading\\AdditionalAutoloader' => __DIR__ . '/../..' . '/src/Autoloading/AdditionalAutoloader.php',
|
||||
'Rector\\Core\\Autoloading\\BootstrapFilesIncluder' => __DIR__ . '/../..' . '/src/Autoloading/BootstrapFilesIncluder.php',
|
||||
'Rector\\Core\\Bootstrap\\ExtensionConfigResolver' => __DIR__ . '/../..' . '/src/Bootstrap/ExtensionConfigResolver.php',
|
||||
|
@ -3484,9 +3470,9 @@ class ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit4fc2c55889d3d94c2b1d3f0602fe6e7d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf6d96ea7adfab7704dfa6631d285d1fa::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
134
vendor/composer/installed.json
vendored
134
vendor/composer/installed.json
vendored
|
@ -1,81 +1,5 @@
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer\/package-versions-deprecated",
|
||||
"version": "1.11.99.1",
|
||||
"version_normalized": "1.11.99.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/composer\/package-versions-deprecated.git",
|
||||
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/composer\/package-versions-deprecated\/zipball\/7413f0b55a051e89485c5cb9f765fe24bb02a7b6",
|
||||
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.1.0 || ^2.0",
|
||||
"php": "^7 || ^8"
|
||||
},
|
||||
"replace": {
|
||||
"ocramius\/package-versions": "1.11.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer\/composer": "^1.9.3 || ^2.0@dev",
|
||||
"ext-zip": "^1.13",
|
||||
"phpunit\/phpunit": "^6.5 || ^7"
|
||||
},
|
||||
"time": "2020-11-11T10:22:58+00:00",
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\PackageVersions\\": "src\/PackageVersions"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/composer\/package-versions-deprecated\/issues",
|
||||
"source": "https:\/\/github.com\/composer\/package-versions-deprecated\/tree\/1.11.99.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https:\/\/packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https:\/\/github.com\/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https:\/\/tidelift.com\/funding\/github\/packagist\/composer\/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": ".\/package-versions-deprecated"
|
||||
},
|
||||
{
|
||||
"name": "composer\/semver",
|
||||
"version": "3.2.4",
|
||||
|
@ -506,64 +430,6 @@
|
|||
},
|
||||
"install-path": "..\/idiosyncratic\/editorconfig"
|
||||
},
|
||||
{
|
||||
"name": "jean85\/pretty-package-versions",
|
||||
"version": "1.6.0",
|
||||
"version_normalized": "1.6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/Jean85\/pretty-package-versions.git",
|
||||
"reference": "1e0104b46f045868f11942aea058cd7186d6c303"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/Jean85\/pretty-package-versions\/zipball\/1e0104b46f045868f11942aea058cd7186d6c303",
|
||||
"reference": "1e0104b46f045868f11942aea058cd7186d6c303",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer\/package-versions-deprecated": "^1.8.0",
|
||||
"php": "^7.0|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^6.0|^8.5|^9.2"
|
||||
},
|
||||
"time": "2021-02-04T16:20:16+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\Jean85\\": "src\/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alessandro Lai",
|
||||
"email": "alessandro.lai85@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A wrapper for ocramius\/package-versions to get pretty versions strings",
|
||||
"keywords": [
|
||||
"composer",
|
||||
"package",
|
||||
"release",
|
||||
"versions"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/Jean85\/pretty-package-versions\/issues",
|
||||
"source": "https:\/\/github.com\/Jean85\/pretty-package-versions\/tree\/1.6.0"
|
||||
},
|
||||
"install-path": "..\/jean85\/pretty-package-versions"
|
||||
},
|
||||
{
|
||||
"name": "nette\/caching",
|
||||
"version": "v3.1.1",
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -1,120 +0,0 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 1.1.3 - 2017-09-06
|
||||
|
||||
This release fixes a bug that caused PackageVersions to prevent
|
||||
the `composer remove` and `composer update` commands to fail when
|
||||
this package is removed.
|
||||
|
||||
In addition to that, mutation testing has been added to the suite,
|
||||
ensuring that the package is accurately and extensively tested.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius
|
||||
- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus
|
||||
- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85
|
||||
|
||||
## 1.1.2 - 2016-12-30
|
||||
|
||||
This release fixes a bug that caused PackageVersions to be enabled
|
||||
even when it was part of a globally installed package.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35)
|
||||
- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38)
|
||||
- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39)
|
||||
|
||||
## 1.1.1 - 2016-07-25
|
||||
|
||||
This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from
|
||||
[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72),
|
||||
as it is no longer needed for `composer install --classmap-authoritative`.
|
||||
Also, that directive was causing issues with HHVM installations, since
|
||||
PackageVersions is not compatible with it.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34)
|
||||
|
||||
## 1.1.0 - 2016-07-22
|
||||
|
||||
This release introduces support for running `composer install --classmap-authoritative`
|
||||
and `composer install --no-scripts`. Please note that performance
|
||||
while using these modes may be degraded, but the package will
|
||||
still work.
|
||||
|
||||
Additionally, the package was tuned to prevent the plugin from
|
||||
running twice at installation.
|
||||
|
||||
Total issues resolved: **10**
|
||||
|
||||
- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18)
|
||||
- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20)
|
||||
- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22)
|
||||
- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23)
|
||||
- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27)
|
||||
- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29)
|
||||
- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30)
|
||||
- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31)
|
||||
- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32)
|
||||
- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33)
|
||||
|
||||
## 1.0.4 - 2016-04-23
|
||||
|
||||
This release includes a fix/workaround for composer/composer#5237,
|
||||
which causes `ocramius/package-versions` to sometimes generate a
|
||||
`Versions` class with malformed name (something like
|
||||
`Versions_composer_tmp0`) when running `composer require <package-name>`.
|
||||
|
||||
Total issues resolved: **2**
|
||||
|
||||
- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16)
|
||||
- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17)
|
||||
|
||||
## 1.0.3 - 2016-02-26
|
||||
|
||||
This release fixes an issue related to concurrent autoloader
|
||||
re-generation caused by multiple composer plugins being installed.
|
||||
The issue was solved by removing autoloader re-generation from this
|
||||
package, but it may still affect other packages.
|
||||
|
||||
It is now recommended that you run `composer dump-autoload --optimize`
|
||||
after installation when using this particular package.
|
||||
Please note that `composer (install|update) -o` is not sufficient
|
||||
to avoid autoload overhead when using this particular package.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15)
|
||||
|
||||
## 1.0.2 - 2016-02-24
|
||||
|
||||
This release fixes issues related to installing the component without
|
||||
any dev dependencies or with packages that don't have a source or dist
|
||||
reference, which is usual with packages defined directly in the
|
||||
`composer.json`.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11)
|
||||
- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12)
|
||||
- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13)
|
||||
|
||||
## 1.0.1 - 2016-02-01
|
||||
|
||||
This release fixes an issue related with composer updates to
|
||||
already installed versions.
|
||||
Using `composer require` within a package that already used
|
||||
`ocramius/package-versions` caused the installation to be unable
|
||||
to write the `PackageVersions\Versions` class to a file.
|
||||
|
||||
Total issues resolved: **6**
|
||||
|
||||
- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2)
|
||||
- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3)
|
||||
- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5)
|
||||
- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6)
|
||||
- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7)
|
||||
- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8)
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
title: Contributing
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
* Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
||||
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
||||
* Any contribution must provide tests for additional introduced conditions
|
||||
* Any un-confirmed issue needs a failing test case before being accepted
|
||||
* Pull requests must be sent from a new hotfix/feature branch, not from `master`.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the project and run the tests, you need to clone it first:
|
||||
|
||||
```sh
|
||||
$ git clone git://github.com/Ocramius/PackageVersions.git
|
||||
```
|
||||
|
||||
You will then need to run a composer installation:
|
||||
|
||||
```sh
|
||||
$ cd PackageVersions
|
||||
$ curl -s https://getcomposer.org/installer | php
|
||||
$ php composer.phar update
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
The PHPUnit version to be used is the one installed as a dev- dependency via composer:
|
||||
|
||||
```sh
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement
|
||||
won't be merged.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Copyright (c) 2016 Marco Pivetta
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,5 +0,0 @@
|
|||
# Package Versions
|
||||
|
||||
**`composer/package-versions-deprecated` is a fully-compatible fork of [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions)** which provides compatibility with Composer 1 and 2 on PHP 7+. It replaces ocramius/package-versions so if you have a dependency requiring it and you want to use Composer v2 but can not upgrade to PHP 7.4 just yet, you can require this package instead.
|
||||
|
||||
If you have a direct dependency on ocramius/package-versions, we recommend instead that once you migrated to Composer 2 you also migrate to use the `Composer\Versions` class which offers the functionality present here out of the box.
|
|
@ -1,5 +0,0 @@
|
|||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"name": "composer\/package-versions-deprecated",
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"type": "composer-plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7 || ^8",
|
||||
"composer-plugin-api": "^1.1.0 || ^2.0"
|
||||
},
|
||||
"replace": {
|
||||
"ocramius\/package-versions": "1.11.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^6.5 || ^7",
|
||||
"composer\/composer": "^1.9.3 || ^2.0@dev",
|
||||
"ext-zip": "^1.13"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\PackageVersions\\": "src\/PackageVersions"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\PackageVersionsTest\\": "test\/PackageVersionsTest"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass",
|
||||
"post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass"
|
||||
}
|
||||
}
|
2603
vendor/composer/package-versions-deprecated/composer.lock
generated
vendored
2603
vendor/composer/package-versions-deprecated/composer.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<arg name="basepath" value="."/>
|
||||
<arg name="extensions" value="php"/>
|
||||
<arg name="parallel" value="80"/>
|
||||
<arg name="cache" value=".phpcs-cache"/>
|
||||
<arg name="colors"/>
|
||||
|
||||
<arg value="nps"/>
|
||||
|
||||
<file>src</file>
|
||||
<file>test</file>
|
||||
|
||||
<rule ref="Doctrine">
|
||||
<exclude-pattern>src/PackageVersions/Versions.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
|
||||
<exclude-pattern>src/PackageVersions/Installer.php</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20210514\PackageVersions;
|
||||
|
||||
use Generator;
|
||||
use OutOfBoundsException;
|
||||
use UnexpectedValueException;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function basename;
|
||||
use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function getcwd;
|
||||
use function iterator_to_array;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
use function sprintf;
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This is a fallback for {@see \PackageVersions\Versions::getVersion()}
|
||||
* Do not use this class directly: it is intended to be only used when
|
||||
* {@see \PackageVersions\Versions} fails to be generated, which typically
|
||||
* happens when running composer with `--no-scripts` flag)
|
||||
*/
|
||||
final class FallbackVersions
|
||||
{
|
||||
const ROOT_PACKAGE_NAME = 'unknown/root-package@UNKNOWN';
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @throws OutOfBoundsException If a version cannot be located.
|
||||
* @throws UnexpectedValueException If the composer.lock file could not be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName) : string
|
||||
{
|
||||
$versions = \iterator_to_array(self::getVersions(self::getPackageData()));
|
||||
if (!\array_key_exists($packageName, $versions)) {
|
||||
throw new \OutOfBoundsException('Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files');
|
||||
}
|
||||
return $versions[$packageName];
|
||||
}
|
||||
/**
|
||||
* @return mixed[]
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
private static function getPackageData() : array
|
||||
{
|
||||
$checkedPaths = [
|
||||
// The top-level project's ./vendor/composer/installed.json
|
||||
\getcwd() . '/vendor/composer/installed.json',
|
||||
__DIR__ . '/../../../../composer/installed.json',
|
||||
// The top-level project's ./composer.lock
|
||||
\getcwd() . '/composer.lock',
|
||||
__DIR__ . '/../../../../../composer.lock',
|
||||
// This package's composer.lock
|
||||
__DIR__ . '/../../composer.lock',
|
||||
];
|
||||
$packageData = [];
|
||||
foreach ($checkedPaths as $path) {
|
||||
if (!\file_exists($path)) {
|
||||
continue;
|
||||
}
|
||||
$data = \json_decode(\file_get_contents($path), \true);
|
||||
switch (\basename($path)) {
|
||||
case 'installed.json':
|
||||
// composer 2.x installed.json format
|
||||
if (isset($data['packages'])) {
|
||||
$packageData[] = $data['packages'];
|
||||
} else {
|
||||
// composer 1.x installed.json format
|
||||
$packageData[] = $data;
|
||||
}
|
||||
break;
|
||||
case 'composer.lock':
|
||||
$packageData[] = $data['packages'] + ($data['packages-dev'] ?? []);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
if ($packageData !== []) {
|
||||
return \array_merge(...$packageData);
|
||||
}
|
||||
throw new \UnexpectedValueException(\sprintf('PackageVersions could not locate the `vendor/composer/installed.json` or your `composer.lock` ' . 'location. This is assumed to be in %s. If you customized your composer vendor directory and ran composer ' . 'installation with --no-scripts, or if you deployed without the required composer files, PackageVersions ' . 'can\'t detect installed versions.', \json_encode($checkedPaths)));
|
||||
}
|
||||
/**
|
||||
* @param mixed[] $packageData
|
||||
*
|
||||
* @return Generator&string[]
|
||||
*
|
||||
* @psalm-return Generator<string, string>
|
||||
*/
|
||||
private static function getVersions(array $packageData) : \Generator
|
||||
{
|
||||
foreach ($packageData as $package) {
|
||||
(yield $package['name'] => $package['version'] . '@' . ($package['source']['reference'] ?? $package['dist']['reference'] ?? ''));
|
||||
}
|
||||
(yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME);
|
||||
}
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace RectorPrefix20210514\PackageVersions;
|
||||
|
||||
use RectorPrefix20210514\Composer\Composer;
|
||||
use RectorPrefix20210514\Composer\Config;
|
||||
use RectorPrefix20210514\Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use RectorPrefix20210514\Composer\IO\IOInterface;
|
||||
use RectorPrefix20210514\Composer\Package\AliasPackage;
|
||||
use RectorPrefix20210514\Composer\Package\Locker;
|
||||
use RectorPrefix20210514\Composer\Package\PackageInterface;
|
||||
use RectorPrefix20210514\Composer\Package\RootPackageInterface;
|
||||
use RectorPrefix20210514\Composer\Plugin\PluginInterface;
|
||||
use RectorPrefix20210514\Composer\Script\Event;
|
||||
use RectorPrefix20210514\Composer\Script\ScriptEvents;
|
||||
use Generator;
|
||||
use RuntimeException;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function chmod;
|
||||
use function dirname;
|
||||
use function file_exists;
|
||||
use function file_put_contents;
|
||||
use function is_writable;
|
||||
use function iterator_to_array;
|
||||
use function rename;
|
||||
use function sprintf;
|
||||
use function uniqid;
|
||||
use function var_export;
|
||||
final class Installer implements \RectorPrefix20210514\Composer\Plugin\PluginInterface, \RectorPrefix20210514\Composer\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
private static $generatedClassTemplate = <<<'PHP'
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use OutOfBoundsException;
|
||||
|
||||
class_exists(InstalledVersions::class);
|
||||
|
||||
/**
|
||||
* This class is generated by composer/package-versions-deprecated, specifically by
|
||||
* @see \PackageVersions\Installer
|
||||
*
|
||||
* This file is overwritten at every run of `composer install` or `composer update`.
|
||||
*
|
||||
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
|
||||
*/
|
||||
%s
|
||||
{
|
||||
/**
|
||||
* @deprecated please use {@see self::rootPackageName()} instead.
|
||||
* This constant will be removed in version 2.0.0.
|
||||
*/
|
||||
const ROOT_PACKAGE_NAME = '%s';
|
||||
|
||||
/**
|
||||
* Array of all available composer packages.
|
||||
* Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead.
|
||||
*
|
||||
* @var array<string, string>
|
||||
* @internal
|
||||
*/
|
||||
const VERSIONS = %s;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
*
|
||||
* @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
|
||||
* cause any side effects here.
|
||||
*/
|
||||
public static function rootPackageName() : string
|
||||
{
|
||||
if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) {
|
||||
return self::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
|
||||
return InstalledVersions::getRootPackage()['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OutOfBoundsException If a version cannot be located.
|
||||
*
|
||||
* @psalm-param key-of<self::VERSIONS> $packageName
|
||||
* @psalm-pure
|
||||
*
|
||||
* @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
|
||||
* cause any side effects here.
|
||||
*/
|
||||
public static function getVersion(string $packageName): string
|
||||
{
|
||||
if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) {
|
||||
return InstalledVersions::getPrettyVersion($packageName)
|
||||
. '@' . InstalledVersions::getReference($packageName);
|
||||
}
|
||||
|
||||
if (isset(self::VERSIONS[$packageName])) {
|
||||
return self::VERSIONS[$packageName];
|
||||
}
|
||||
|
||||
throw new OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PHP;
|
||||
public function activate(\RectorPrefix20210514\Composer\Composer $composer, \RectorPrefix20210514\Composer\IO\IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
public function deactivate(\RectorPrefix20210514\Composer\Composer $composer, \RectorPrefix20210514\Composer\IO\IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
public function uninstall(\RectorPrefix20210514\Composer\Composer $composer, \RectorPrefix20210514\Composer\IO\IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents() : array
|
||||
{
|
||||
return [\RectorPrefix20210514\Composer\Script\ScriptEvents::POST_AUTOLOAD_DUMP => 'dumpVersionsClass'];
|
||||
}
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function dumpVersionsClass(\RectorPrefix20210514\Composer\Script\Event $composerEvent)
|
||||
{
|
||||
$composer = $composerEvent->getComposer();
|
||||
$rootPackage = $composer->getPackage();
|
||||
$versions = \iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage));
|
||||
if (!\array_key_exists('composer/package-versions-deprecated', $versions)) {
|
||||
//plugin must be globally installed - we only want to generate versions for projects which specifically
|
||||
//require composer/package-versions-deprecated
|
||||
return;
|
||||
}
|
||||
$versionClass = self::generateVersionsClass($rootPackage->getName(), $versions);
|
||||
self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO());
|
||||
}
|
||||
/**
|
||||
* @param string[] $versions
|
||||
*/
|
||||
private static function generateVersionsClass(string $rootPackageName, array $versions) : string
|
||||
{
|
||||
return \sprintf(
|
||||
self::$generatedClassTemplate,
|
||||
'fin' . 'al ' . 'cla' . 'ss ' . 'Versions',
|
||||
// note: workaround for regex-based code parsers :-(
|
||||
$rootPackageName,
|
||||
\var_export($versions, \true)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function writeVersionClassToFile(string $versionClassSource, \RectorPrefix20210514\Composer\Composer $composer, \RectorPrefix20210514\Composer\IO\IOInterface $io)
|
||||
{
|
||||
$installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage()) . '/src/PackageVersions/Versions.php';
|
||||
$installDir = \dirname($installPath);
|
||||
if (!\file_exists($installDir)) {
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> Package not found (probably scheduled for removal); generation of version class skipped.');
|
||||
return;
|
||||
}
|
||||
if (!\is_writable($installDir)) {
|
||||
$io->write(\sprintf('<info>composer/package-versions-deprecated:</info> %s is not writable; generation of version class skipped.', $installDir));
|
||||
return;
|
||||
}
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> Generating version class...');
|
||||
$installPathTmp = $installPath . '_' . \uniqid('tmp', \true);
|
||||
\file_put_contents($installPathTmp, $versionClassSource);
|
||||
\chmod($installPathTmp, 0664);
|
||||
\rename($installPathTmp, $installPath);
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> ...done generating version class');
|
||||
}
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function locateRootPackageInstallPath(\RectorPrefix20210514\Composer\Config $composerConfig, \RectorPrefix20210514\Composer\Package\RootPackageInterface $rootPackage) : string
|
||||
{
|
||||
if (self::getRootPackageAlias($rootPackage)->getName() === 'composer/package-versions-deprecated') {
|
||||
return \dirname($composerConfig->get('vendor-dir'));
|
||||
}
|
||||
return $composerConfig->get('vendor-dir') . '/composer/package-versions-deprecated';
|
||||
}
|
||||
private static function getRootPackageAlias(\RectorPrefix20210514\Composer\Package\RootPackageInterface $rootPackage) : \RectorPrefix20210514\Composer\Package\PackageInterface
|
||||
{
|
||||
$package = $rootPackage;
|
||||
while ($package instanceof \RectorPrefix20210514\Composer\Package\AliasPackage) {
|
||||
$package = $package->getAliasOf();
|
||||
}
|
||||
return $package;
|
||||
}
|
||||
/**
|
||||
* @return Generator&string[]
|
||||
*
|
||||
* @psalm-return Generator<string, string>
|
||||
*/
|
||||
private static function getVersions(\RectorPrefix20210514\Composer\Package\Locker $locker, \RectorPrefix20210514\Composer\Package\RootPackageInterface $rootPackage) : \Generator
|
||||
{
|
||||
$lockData = $locker->getLockData();
|
||||
$lockData['packages-dev'] = $lockData['packages-dev'] ?? [];
|
||||
$packages = $lockData['packages'];
|
||||
if (\getenv('COMPOSER_DEV_MODE') !== '0') {
|
||||
$packages = \array_merge($packages, $lockData['packages-dev']);
|
||||
}
|
||||
foreach ($packages as $package) {
|
||||
(yield $package['name'] => $package['version'] . '@' . ($package['source']['reference'] ?? $package['dist']['reference'] ?? ''));
|
||||
}
|
||||
foreach ($rootPackage->getReplaces() as $replace) {
|
||||
$version = $replace->getPrettyConstraint();
|
||||
if ($version === 'self.version') {
|
||||
$version = $rootPackage->getPrettyVersion();
|
||||
}
|
||||
(yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference());
|
||||
}
|
||||
(yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference());
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
21
vendor/jean85/pretty-package-versions/LICENSE
vendored
21
vendor/jean85/pretty-package-versions/LICENSE
vendored
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Alessandro Lai
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1 +0,0 @@
|
|||
comment: false
|
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
"name": "jean85\/pretty-package-versions",
|
||||
"description": "A wrapper for ocramius\/package-versions to get pretty versions strings",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": "^7.0|^8.0",
|
||||
"composer\/package-versions-deprecated": "^1.8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^6.0|^8.5|^9.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alessandro Lai",
|
||||
"email": "alessandro.lai85@gmail.com"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/Jean85\/pretty-package-versions\/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"package",
|
||||
"versions",
|
||||
"composer",
|
||||
"release"
|
||||
],
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\Jean85\\": "src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210514\\Tests\\": "tests"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210514\Jean85;
|
||||
|
||||
use RectorPrefix20210514\PackageVersions\Versions;
|
||||
class PrettyVersions
|
||||
{
|
||||
const SHORT_COMMIT_LENGTH = 7;
|
||||
public static function getVersion(string $packageName) : \RectorPrefix20210514\Jean85\Version
|
||||
{
|
||||
return new \RectorPrefix20210514\Jean85\Version($packageName, \RectorPrefix20210514\PackageVersions\Versions::getVersion($packageName));
|
||||
}
|
||||
public static function getRootPackageName() : string
|
||||
{
|
||||
return \RectorPrefix20210514\PackageVersions\Versions::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
public static function getRootPackageVersion() : \RectorPrefix20210514\Jean85\Version
|
||||
{
|
||||
return self::getVersion(\RectorPrefix20210514\PackageVersions\Versions::ROOT_PACKAGE_NAME);
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210514\Jean85;
|
||||
|
||||
class Version
|
||||
{
|
||||
const SHORT_COMMIT_LENGTH = \RectorPrefix20210514\Jean85\PrettyVersions::SHORT_COMMIT_LENGTH;
|
||||
/** @var string */
|
||||
private $packageName;
|
||||
/** @var string */
|
||||
private $shortVersion;
|
||||
/** @var string */
|
||||
private $commitHash;
|
||||
/** @var bool */
|
||||
private $versionIsTagged;
|
||||
public function __construct(string $packageName, string $version)
|
||||
{
|
||||
$this->packageName = $packageName;
|
||||
$splittedVersion = \explode('@', $version);
|
||||
$this->shortVersion = $splittedVersion[0];
|
||||
$this->commitHash = $splittedVersion[1];
|
||||
$this->versionIsTagged = \preg_match('/[^v\\d\\.]/', $this->getShortVersion()) === 0;
|
||||
}
|
||||
public function getPrettyVersion() : string
|
||||
{
|
||||
if ($this->versionIsTagged) {
|
||||
return $this->getShortVersion();
|
||||
}
|
||||
return $this->getVersionWithShortCommit();
|
||||
}
|
||||
public function getFullVersion() : string
|
||||
{
|
||||
return $this->getShortVersion() . '@' . $this->getCommitHash();
|
||||
}
|
||||
public function getVersionWithShortReference() : string
|
||||
{
|
||||
return $this->getShortVersion() . '@' . $this->getShortCommitHash();
|
||||
}
|
||||
/**
|
||||
* @deprecated since 1.6, use getVersionWithShortReference instead
|
||||
*/
|
||||
public function getVersionWithShortCommit() : string
|
||||
{
|
||||
return $this->getVersionWithShortReference();
|
||||
}
|
||||
public function getPackageName() : string
|
||||
{
|
||||
return $this->packageName;
|
||||
}
|
||||
public function getShortVersion() : string
|
||||
{
|
||||
return $this->shortVersion;
|
||||
}
|
||||
public function getReference() : string
|
||||
{
|
||||
return $this->commitHash;
|
||||
}
|
||||
/**
|
||||
* @deprecated since 1.6, use getReference instead
|
||||
*/
|
||||
public function getCommitHash() : string
|
||||
{
|
||||
return $this->getReference();
|
||||
}
|
||||
public function getShortReference() : string
|
||||
{
|
||||
return \substr($this->commitHash, 0, self::SHORT_COMMIT_LENGTH);
|
||||
}
|
||||
/**
|
||||
* @deprecated since 1.6, use getShortReference instead
|
||||
*/
|
||||
public function getShortCommitHash() : string
|
||||
{
|
||||
return $this->getShortReference();
|
||||
}
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->getPrettyVersion();
|
||||
}
|
||||
}
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210514\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d', false) && !interface_exists('ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d', false) && !trait_exists('ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d', false)) {
|
||||
spl_autoload_call('RectorPrefix20210514\ComposerAutoloaderInit4fc2c55889d3d94c2b1d3f0602fe6e7d');
|
||||
if (!class_exists('ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa', false) && !interface_exists('ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa', false) && !trait_exists('ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa', false)) {
|
||||
spl_autoload_call('RectorPrefix20210514\ComposerAutoloaderInitf6d96ea7adfab7704dfa6631d285d1fa');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210514\Doctrine\Inflector\Inflector');
|
||||
|
@ -95,9 +95,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210514\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire4fc2c55889d3d94c2b1d3f0602fe6e7d')) {
|
||||
function composerRequire4fc2c55889d3d94c2b1d3f0602fe6e7d() {
|
||||
return \RectorPrefix20210514\composerRequire4fc2c55889d3d94c2b1d3f0602fe6e7d(...func_get_args());
|
||||
if (!function_exists('composerRequiref6d96ea7adfab7704dfa6631d285d1fa')) {
|
||||
function composerRequiref6d96ea7adfab7704dfa6631d285d1fa() {
|
||||
return \RectorPrefix20210514\composerRequiref6d96ea7adfab7704dfa6631d285d1fa(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user