Updated Rector to commit d292e9dab5

d292e9dab5 remove lass process
This commit is contained in:
Tomas Votruba 2022-05-29 20:46:31 +00:00
parent 824b15c9ab
commit d86003f0c9
5 changed files with 32 additions and 67 deletions

View File

@ -1,13 +1,10 @@
<?php <?php
declare(strict_types=1); declare (strict_types=1);
namespace Rector\Core\Application; namespace Rector\Core\Application;
use DateTime; use DateTime;
use Rector\Core\Exception\VersionException; use Rector\Core\Exception\VersionException;
use Symfony\Component\Process\Process;
/** /**
* Inspired by https://github.com/composer/composer/blob/master/src/Composer/Composer.php * Inspired by https://github.com/composer/composer/blob/master/src/Composer/Composer.php
* See https://github.com/composer/composer/blob/6587715d0f8cae0cd39073b3bc5f018d0e6b84fe/src/Composer/Compiler.php#L208 * See https://github.com/composer/composer/blob/6587715d0f8cae0cd39073b3bc5f018d0e6b84fe/src/Composer/Compiler.php#L208
@ -19,73 +16,41 @@ final class VersionResolver
/** /**
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '@package_version@'; public const PACKAGE_VERSION = 'd292e9dab5a3ccc8a690936a67eaf02d2ecc2416';
/** /**
* @var string * @var string
*/ */
public const RELEASE_DATE = '@release_date@'; public const RELEASE_DATE = '2022-05-29 22:40:09';
/**
* @var string
*/
private const GIT = 'git';
/** /**
* @var int * @var int
*/ */
private const SUCCESS_CODE = 0; private const SUCCESS_CODE = 0;
public static function resolvePackageVersion() : string
public static function resolvePackageVersion(): string
{ {
// needed to keep exec() in the rector directory, not depending on cwd of run command of scoper
$repositoryDirectory = __DIR__ . '/../..';
// resolve current tag // resolve current tag
$commandLine = sprintf('cd %s && git tag --points-at', $repositoryDirectory); \exec('git tag --points-at', $tagExecOutput, $tagExecResultCode);
exec($commandLine, $tagExecOutput, $tagExecResultCode);
if ($tagExecResultCode !== self::SUCCESS_CODE) { if ($tagExecResultCode !== self::SUCCESS_CODE) {
throw new VersionException( throw new \Rector\Core\Exception\VersionException('Ensure to run compile from composer git repository clone and that git binary is available.');
'Ensure to run compile from composer git repository clone and that git binary is available.'
);
} }
// debug output
var_dump($tagExecOutput);
if ($tagExecOutput !== []) { if ($tagExecOutput !== []) {
$tag = $tagExecOutput[0]; $tag = $tagExecOutput[0];
if ($tag !== '') { if ($tag !== '') {
return $tag; return $tag;
} }
} }
\exec('git log --pretty="%H" -n1 HEAD', $commitHashExecOutput, $commitHashResultCode);
$commandLine = sprintf('cd %s && git log --pretty="%%H" -n1 HEAD', $repositoryDirectory);
exec($commandLine, $commitHashExecOutput, $commitHashResultCode);
if ($commitHashResultCode !== 0) { if ($commitHashResultCode !== 0) {
throw new VersionException( throw new \Rector\Core\Exception\VersionException('Ensure to run compile from composer git repository clone and that git binary is available.');
'Ensure to run compile from composer git repository clone and that git binary is available.'
);
} }
$version = \trim($commitHashExecOutput[0]);
// debug output return \trim($version, '"');
var_dump($commitHashExecOutput);
$version = trim($commitHashExecOutput[0]);
return trim($version, '"');
} }
public static function resolverReleaseDateTime() : \DateTime
public static function resolverReleaseDateTime(): DateTime
{ {
$process = new Process([self::GIT, 'log', '-n1', '--pretty=%ci', 'HEAD'], __DIR__); \exec('git log -n1 --pretty=%ci HEAD', $output, $resultCode);
if ($process->run() !== 0) { if ($resultCode !== self::SUCCESS_CODE) {
throw new VersionException( throw new \Rector\Core\Exception\VersionException('You must ensure to run compile from composer git repository clone and that git binary is available.');
'You must ensure to run compile from composer git repository clone and that git binary is available.'
);
} }
return new \DateTime(\trim($output[0]));
return new DateTime(trim($process->getOutput()));
} }
} }

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915::getLoader(); return ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915 class ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192
{ {
private static $loader; private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915::$files; $includeFiles = \Composer\Autoload\ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192::$files;
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireff688ad1ad36414b5e0335c1fc3e9915($fileIdentifier, $file); composerRequireb46b6aeaf3e35873cae96a943ec65192($fileIdentifier, $file);
} }
return $loader; return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915
* @param string $file * @param string $file
* @return void * @return void
*/ */
function composerRequireff688ad1ad36414b5e0335c1fc3e9915($fileIdentifier, $file) function composerRequireb46b6aeaf3e35873cae96a943ec65192($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915 class ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192
{ {
public static $files = array ( public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3850,9 +3850,9 @@ class ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitff688ad1ad36414b5e0335c1fc3e9915::$classMap; $loader->classMap = ComposerStaticInitb46b6aeaf3e35873cae96a943ec65192::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -12,8 +12,8 @@ if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadInclu
if (!class_exists('VersionResolver', false) && !interface_exists('VersionResolver', false) && !trait_exists('VersionResolver', false)) { if (!class_exists('VersionResolver', false) && !interface_exists('VersionResolver', false) && !trait_exists('VersionResolver', false)) {
spl_autoload_call('RectorPrefix20220529\VersionResolver'); spl_autoload_call('RectorPrefix20220529\VersionResolver');
} }
if (!class_exists('ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915', false) && !interface_exists('ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915', false) && !trait_exists('ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915', false)) { if (!class_exists('ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192', false) && !interface_exists('ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192', false) && !trait_exists('ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192', false)) {
spl_autoload_call('RectorPrefix20220529\ComposerAutoloaderInitff688ad1ad36414b5e0335c1fc3e9915'); spl_autoload_call('RectorPrefix20220529\ComposerAutoloaderInitb46b6aeaf3e35873cae96a943ec65192');
} }
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) { if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220529\Helmich\TypoScriptParser\Parser\AST\Statement'); spl_autoload_call('RectorPrefix20220529\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -62,9 +62,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220529\print_node(...func_get_args()); return \RectorPrefix20220529\print_node(...func_get_args());
} }
} }
if (!function_exists('composerRequireff688ad1ad36414b5e0335c1fc3e9915')) { if (!function_exists('composerRequireb46b6aeaf3e35873cae96a943ec65192')) {
function composerRequireff688ad1ad36414b5e0335c1fc3e9915() { function composerRequireb46b6aeaf3e35873cae96a943ec65192() {
return \RectorPrefix20220529\composerRequireff688ad1ad36414b5e0335c1fc3e9915(...func_get_args()); return \RectorPrefix20220529\composerRequireb46b6aeaf3e35873cae96a943ec65192(...func_get_args());
} }
} }
if (!function_exists('scanPath')) { if (!function_exists('scanPath')) {