Updated Rector to commit 625bc7eee281d46b0e7c706d9ca9e259b7ef0db6

625bc7eee2 Fix platform version resolution, use require first (#5555)
This commit is contained in:
Tomas Votruba 2024-02-04 23:14:35 +00:00
parent 8cb186674a
commit b0c6aaf812
4 changed files with 11 additions and 13 deletions

View File

@ -23,6 +23,7 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Exception\Configuration\InvalidConfigurationException;
use Rector\Naming\Naming\UseImportsResolver;
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
use Rector\Php80\NodeFactory\AttrGroupsFactory;
@ -32,7 +33,6 @@ use Rector\Php80\ValueObject\DoctrineTagAndAnnotationToAttribute;
use Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory;
use Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser;
use Rector\Rector\AbstractRector;
use Rector\Exception\Configuration\InvalidConfigurationException;
use Rector\ValueObject\PhpVersionFeature;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '037153ba50e85666dc8bdc90f832ea4c0ff3677e';
public const PACKAGE_VERSION = '625bc7eee281d46b0e7c706d9ca9e259b7ef0db6';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-02-05 04:51:31';
public const RELEASE_DATE = '2024-02-05 00:12:02';
/**
* @var int
*/

View File

@ -23,18 +23,19 @@ final class ProjectComposerJsonPhpVersionResolver
}
$composerJsonContents = FileSystem::read($composerJson);
$projectComposerJson = Json::decode($composerJsonContents, Json::FORCE_ARRAY);
// give this one a priority, as more generic one
$requirePhpVersion = $projectComposerJson['require']['php'] ?? null;
if ($requirePhpVersion !== null) {
self::$cachedPhpVersions[$composerJson] = self::createIntVersionFromComposerVersion($requirePhpVersion);
return self::$cachedPhpVersions[$composerJson];
}
// see https://getcomposer.org/doc/06-config.md#platform
$platformPhp = $projectComposerJson['config']['platform']['php'] ?? null;
if ($platformPhp !== null) {
self::$cachedPhpVersions[$composerJson] = PhpVersionFactory::createIntVersion($platformPhp);
return self::$cachedPhpVersions[$composerJson];
}
$requirePhpVersion = $projectComposerJson['require']['php'] ?? null;
if ($requirePhpVersion === null) {
return self::$cachedPhpVersions[$composerJson] = null;
}
self::$cachedPhpVersions[$composerJson] = self::createIntVersionFromComposerVersion($requirePhpVersion);
return self::$cachedPhpVersions[$composerJson];
return null;
}
private static function createIntVersionFromComposerVersion(string $projectPhpVersion) : int
{

View File

@ -13,12 +13,9 @@ final class PhpVersionFactory
}
$explodeVersion = \explode('.', $version);
$countExplodedVersion = \count($explodeVersion);
if ($countExplodedVersion === 2) {
if ($countExplodedVersion >= 2) {
return (int) $explodeVersion[0] * 10000 + (int) $explodeVersion[1] * 100;
}
if ($countExplodedVersion >= 3) {
return (int) $explodeVersion[0] * 10000 + (int) $explodeVersion[1] * 100 + (int) $explodeVersion[2];
}
return (int) $version;
}
}