Updated Rector to commit fafa4013f6996e47724aad11d4ef0c10d3a9cd14

fafa4013f6 Cleanup few duplicated test fixtures, fix SimplifyEmptyCheckOnEmptyArrayRector test namespace (#6056)
This commit is contained in:
Tomas Votruba 2024-06-27 07:46:59 +00:00
parent 2db7931b21
commit dad1e77265
4 changed files with 31 additions and 7 deletions

View File

@ -0,0 +1,26 @@
<?php
// this is part of downgrade build
declare (strict_types=1);
namespace RectorPrefix202406;
use RectorPrefix202406\Symfony\Component\Finder\Finder;
require __DIR__ . '/../vendor/autoload.php';
$finder = Finder::create()->in(__DIR__ . '/../rules-tests')->directories()->name('#Rector$#')->getIterator();
$ruleToFixtureCount = [];
foreach ($finder as $rectorTestDirectory) {
if ($rectorTestDirectory->getBasename() === 'Rector') {
continue;
}
$fixtureCount = Finder::create()->files()->name('*.php.inc')->in($rectorTestDirectory->getPathname())->count();
// very few fixture files, not relevant
if ($fixtureCount <= 15) {
continue;
}
$ruleToFixtureCount[$rectorTestDirectory->getBasename()] = $fixtureCount;
}
\asort($ruleToFixtureCount);
foreach ($ruleToFixtureCount as $rule => $fixtureCount) {
echo ' * ' . $rule . ': ';
echo $fixtureCount . \PHP_EOL;
}

View File

@ -28,7 +28,7 @@ use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\AllAssignNodeProperty
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRectorTest\SimplifyEmptyCheckOnEmptyArrayRectorTest
* @see \Rector\Tests\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector\SimplifyEmptyCheckOnEmptyArrayRectorTest
*/
final class SimplifyEmptyCheckOnEmptyArrayRector extends AbstractScopeAwareRector
{

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '77a6000e2aab5a9c67d5c1d5a2cb7a168145b068';
public const PACKAGE_VERSION = 'fafa4013f6996e47724aad11d4ef0c10d3a9cd14';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-06-27 07:33:50';
public const RELEASE_DATE = '2024-06-27 07:44:32';
/**
* @var int
*/

View File

@ -4,8 +4,7 @@ declare (strict_types=1);
namespace Rector\Php\PhpVersionResolver;
use RectorPrefix202406\Composer\Semver\VersionParser;
use RectorPrefix202406\Nette\Utils\FileSystem;
use RectorPrefix202406\Nette\Utils\Json;
use Rector\FileSystem\JsonFileSystem;
use Rector\Util\PhpVersionFactory;
/**
* @see \Rector\Tests\Php\PhpVersionResolver\ProjectComposerJsonPhpVersionResolver\ProjectComposerJsonPhpVersionResolverTest
@ -21,8 +20,7 @@ final class ProjectComposerJsonPhpVersionResolver
if (\array_key_exists($composerJson, self::$cachedPhpVersions)) {
return self::$cachedPhpVersions[$composerJson];
}
$composerJsonContents = FileSystem::read($composerJson);
$projectComposerJson = Json::decode($composerJsonContents, \true);
$projectComposerJson = JsonFileSystem::readFilePath($composerJson);
// give this one a priority, as more generic one
$requirePhpVersion = $projectComposerJson['require']['php'] ?? null;
if ($requirePhpVersion !== null) {