Updated Rector to commit ae31fb60aeb3c49fb47b3fa12c792098e67831c5

ae31fb60ae [PHPStan] Resolve variable name casing (#2689)
This commit is contained in:
Tomas Votruba 2022-07-20 05:05:58 +00:00
parent 8a0350a804
commit aa6004e082
14 changed files with 39 additions and 41 deletions

View File

@ -27,11 +27,11 @@ final class AddedFileWithContent implements AddedFileInterface
}
public function getRealPath() : string
{
$realpath = \realpath($this->filePath);
if ($realpath === \false) {
$realPath = \realpath($this->filePath);
if ($realPath === \false) {
throw new ShouldNotHappenException();
}
return $realpath;
return $realPath;
}
public function getFilePath() : string
{

View File

@ -109,8 +109,7 @@ final class NameScopeFactory
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$templateTypes = [];
foreach ($phpDocInfo->getTemplateTagValueNodes() as $templateTagValueNode) {
$phpstanType = $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($templateTagValueNode, $node);
$templateTypes[$templateTagValueNode->name] = $phpstanType;
$templateTypes[$templateTagValueNode->name] = $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($templateTagValueNode, $node);
}
return $templateTypes;
}

View File

@ -47,12 +47,12 @@ final class TestingParser
/**
* @return Node[]
*/
public function parseFileToDecoratedNodes(string $filepath) : array
public function parseFileToDecoratedNodes(string $filePath) : array
{
// autoload file
require_once $filepath;
$smartFileInfo = new SmartFileInfo($filepath);
$this->parameterProvider->changeParameter(Option::SOURCE, [$filepath]);
require_once $filePath;
$smartFileInfo = new SmartFileInfo($filePath);
$this->parameterProvider->changeParameter(Option::SOURCE, [$filePath]);
$nodes = $this->rectorParser->parseFile($smartFileInfo);
$file = new File($smartFileInfo, $smartFileInfo->getContents());
return $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file, $nodes);

View File

@ -83,14 +83,14 @@ CODE_SAMPLE
return $parentNode instanceof BinaryOp;
});
$uniqueInstanceOfKeys = [];
foreach ($instanceOfs as $instanceOf) {
$uniqueKey = $this->instanceOfUniqueKeyResolver->resolve($instanceOf);
foreach ($instanceOfs as $instanceof) {
$uniqueKey = $this->instanceOfUniqueKeyResolver->resolve($instanceof);
if ($uniqueKey === null) {
continue;
}
// already present before → duplicated
if (\in_array($uniqueKey, $uniqueInstanceOfKeys, \true)) {
$duplicatedInstanceOfs[] = $instanceOf;
$duplicatedInstanceOfs[] = $instanceof;
}
$uniqueInstanceOfKeys[] = $uniqueKey;
}

View File

@ -154,10 +154,10 @@ CODE_SAMPLE
return \false;
}
$variable = $instanceof->expr;
$isReassign = (bool) $this->betterNodeFinder->findFirstPrevious($instanceof, function (Node $subNode) use($variable) : bool {
$isReAssign = (bool) $this->betterNodeFinder->findFirstPrevious($instanceof, function (Node $subNode) use($variable) : bool {
return $subNode instanceof Assign && $this->nodeComparator->areNodesEqual($subNode->var, $variable);
});
if ($isReassign) {
if ($isReAssign) {
return \false;
}
$params = $functionLike->getParams();

View File

@ -121,9 +121,9 @@ CODE_SAMPLE
* @param If_[] $ifs
* @return If_[]
*/
private function collectLeftBooleanOrToIfs(BooleanOr $BooleanOr, Return_ $return, array $ifs) : array
private function collectLeftBooleanOrToIfs(BooleanOr $booleanOr, Return_ $return, array $ifs) : array
{
$left = $BooleanOr->left;
$left = $booleanOr->left;
if (!$left instanceof BooleanOr) {
return [$this->ifManipulator->createIfStmt($left, new Return_($this->nodeFactory->createTrue()))];
}

View File

@ -160,8 +160,7 @@ final class ExactCompareFactory
return new Identical($expr, $this->nodeFactory->createTrue());
}
if ($unionType instanceof TypeWithClassName) {
$instanceOf = new Instanceof_($expr, new FullyQualified($unionType->getClassName()));
return new BooleanNot($instanceOf);
return new BooleanNot(new Instanceof_($expr, new FullyQualified($unionType->getClassName())));
}
$toNullIdentical = new Identical($expr, $this->nodeFactory->createNull());
if ($treatAsNonEmpty) {

View File

@ -283,9 +283,9 @@ final class ApplicationFileProcessor
$filePaths = [];
foreach ($files as $file) {
$smartFileInfo = $file->getSmartFileInfo();
$pathName = $smartFileInfo->getPathname();
if (\substr_compare($pathName, '.php', -\strlen('.php')) === 0) {
$filePaths[] = $pathName;
$pathname = $smartFileInfo->getPathname();
if (\substr_compare($pathname, '.php', -\strlen('.php')) === 0) {
$filePaths[] = $pathname;
}
}
return $filePaths;

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '9cb0a5efb59c51c662a4b6eb56753b9cc2174e21';
public const PACKAGE_VERSION = 'ae31fb60aeb3c49fb47b3fa12c792098e67831c5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-07-20 06:55:29';
public const RELEASE_DATE = '2022-07-20 05:00:57';
/**
* @var int
*/

View File

@ -34,24 +34,24 @@ final class PhpFilesFinder
$suffixRegexPattern = StaticNonPhpFileSuffixes::getSuffixRegexPattern();
// filter out non-PHP files
foreach ($phpFileInfos as $key => $phpFileInfo) {
$pathName = $phpFileInfo->getPathname();
$pathname = $phpFileInfo->getPathname();
/**
* check .blade.php early so next .php check in next if can be skipped
*/
if (\substr_compare($pathName, '.blade.php', -\strlen('.blade.php')) === 0) {
if (\substr_compare($pathname, '.blade.php', -\strlen('.blade.php')) === 0) {
unset($phpFileInfos[$key]);
continue;
}
/**
* obvious
*/
if (\substr_compare($pathName, '.php', -\strlen('.php')) === 0) {
if (\substr_compare($pathname, '.php', -\strlen('.php')) === 0) {
continue;
}
/**
* only check with regex when needed
*/
if (StringUtils::isMatch($pathName, $suffixRegexPattern)) {
if (StringUtils::isMatch($pathname, $suffixRegexPattern)) {
unset($phpFileInfos[$key]);
}
}

View File

@ -106,8 +106,8 @@ final class TerminatedNodeAnalyzer
if ($if->elseifs === [] && !$if->else instanceof Else_) {
return \false;
}
foreach ($if->elseifs as $elseIf) {
if (!$this->isTerminatedInLastStmts($elseIf->stmts, $stmt)) {
foreach ($if->elseifs as $elseif) {
if (!$this->isTerminatedInLastStmts($elseif->stmts, $stmt)) {
return \false;
}
}

2
vendor/autoload.php vendored
View File

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

View File

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

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit8e6da83dabd79e423bc3c7245685560a
class ComposerStaticInitc9106d84b938caf4adb82321268441e1
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3402,9 +3402,9 @@ class ComposerStaticInit8e6da83dabd79e423bc3c7245685560a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit8e6da83dabd79e423bc3c7245685560a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8e6da83dabd79e423bc3c7245685560a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8e6da83dabd79e423bc3c7245685560a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitc9106d84b938caf4adb82321268441e1::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc9106d84b938caf4adb82321268441e1::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc9106d84b938caf4adb82321268441e1::$classMap;
}, null, ClassLoader::class);
}