mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit b11942242883c965756d02faba8357884df8131c
b119422428
[TypeDeclaration] Skip ternary on ParamTypeByMethodCallTypeRector (#1131)
This commit is contained in:
parent
f83732a356
commit
c69bc27db8
@ -15,7 +15,7 @@ final class DependencyResolver
|
||||
*/
|
||||
private $nodeScopeResolver;
|
||||
/**
|
||||
* @var PHPStanDependencyResolver
|
||||
* @var \PHPStan\Dependency\DependencyResolver
|
||||
*/
|
||||
private $phpStanDependencyResolver;
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@ use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
final class ScopeFactory
|
||||
{
|
||||
/**
|
||||
* @var PHPStanScopeFactory
|
||||
* @var \PHPStan\Analyser\ScopeFactory
|
||||
*/
|
||||
private $phpStanScopeFactory;
|
||||
public function __construct(\PHPStan\Analyser\ScopeFactory $phpStanScopeFactory)
|
||||
|
@ -5,30 +5,13 @@ namespace Rector\StaticTypeMapper\PhpParser;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Param;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\CodingStyle\ClassNameImport\UsedImportsResolver;
|
||||
use Rector\Core\Provider\CurrentFileProvider;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
final class FullyQualifiedNodeMapper implements \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\Provider\CurrentFileProvider
|
||||
*/
|
||||
private $currentFileProvider;
|
||||
/**
|
||||
* @var \Rector\CodingStyle\ClassNameImport\UsedImportsResolver
|
||||
*/
|
||||
private $usedImportsResolver;
|
||||
public function __construct(\Rector\Core\Provider\CurrentFileProvider $currentFileProvider, \Rector\CodingStyle\ClassNameImport\UsedImportsResolver $usedImportsResolver)
|
||||
{
|
||||
$this->currentFileProvider = $currentFileProvider;
|
||||
$this->usedImportsResolver = $usedImportsResolver;
|
||||
}
|
||||
/**
|
||||
* @return class-string<Node>
|
||||
*/
|
||||
@ -41,13 +24,6 @@ final class FullyQualifiedNodeMapper implements \Rector\StaticTypeMapper\Contrac
|
||||
*/
|
||||
public function mapToPHPStan($node) : \PHPStan\Type\Type
|
||||
{
|
||||
$parent = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if ($parent instanceof \PhpParser\Node\Param && $parent->type === $node) {
|
||||
$possibleAliasedObjectType = $this->resolvePossibleAliasedObjectType($node);
|
||||
if ($possibleAliasedObjectType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
|
||||
return $possibleAliasedObjectType;
|
||||
}
|
||||
}
|
||||
$originalName = (string) $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::ORIGINAL_NAME);
|
||||
$fullyQualifiedName = $node->toString();
|
||||
// is aliased?
|
||||
@ -56,33 +32,6 @@ final class FullyQualifiedNodeMapper implements \Rector\StaticTypeMapper\Contrac
|
||||
}
|
||||
return new \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType($fullyQualifiedName);
|
||||
}
|
||||
private function resolvePossibleAliasedObjectType(\PhpParser\Node\Name\FullyQualified $fullyQualified) : ?\Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType
|
||||
{
|
||||
$file = $this->currentFileProvider->getFile();
|
||||
if (!$file instanceof \Rector\Core\ValueObject\Application\File) {
|
||||
return null;
|
||||
}
|
||||
$oldTokens = $file->getOldTokens();
|
||||
$startTokenPos = $fullyQualified->getStartTokenPos();
|
||||
if (!isset($oldTokens[$startTokenPos][1])) {
|
||||
return null;
|
||||
}
|
||||
$type = $oldTokens[$startTokenPos][1];
|
||||
if (\strpos($type, '\\') !== \false) {
|
||||
return null;
|
||||
}
|
||||
$objectTypes = $this->usedImportsResolver->resolveForNode($fullyQualified);
|
||||
foreach ($objectTypes as $objectType) {
|
||||
if (!$objectType instanceof \Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType) {
|
||||
continue;
|
||||
}
|
||||
if ($objectType->getClassName() !== $type) {
|
||||
continue;
|
||||
}
|
||||
return $objectType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function isAliasedName(string $originalName, string $fullyQualifiedName) : bool
|
||||
{
|
||||
if ($originalName === '') {
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '6cbc5d4caf64061bd69834a394573f78520f3dd1';
|
||||
public const PACKAGE_VERSION = 'b11942242883c965756d02faba8357884df8131c';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-11-03 09:47:39';
|
||||
public const RELEASE_DATE = '2021-11-03 08:47:17';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211103\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e::getLoader();
|
||||
return ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857::getLoader();
|
||||
|
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 ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e
|
||||
class ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857', '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\ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6f87d38fbfa82010b9af154bb6015857::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit6f87d38fbfa82010b9af154bb6015857::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiref83c3b4cb9d6183aa3c1d4823093b37e($fileIdentifier, $file);
|
||||
composerRequire6f87d38fbfa82010b9af154bb6015857($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequiref83c3b4cb9d6183aa3c1d4823093b37e($fileIdentifier, $file)
|
||||
function composerRequire6f87d38fbfa82010b9af154bb6015857($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e
|
||||
class ComposerStaticInit6f87d38fbfa82010b9af154bb6015857
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -3505,9 +3505,9 @@ class ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf83c3b4cb9d6183aa3c1d4823093b37e::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6f87d38fbfa82010b9af154bb6015857::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6f87d38fbfa82010b9af154bb6015857::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6f87d38fbfa82010b9af154bb6015857::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ CODE_SAMPLE;
|
||||
*/
|
||||
private $installationManager;
|
||||
/**
|
||||
* @var ComposerFilesystem
|
||||
* @var \Composer\Util\Filesystem
|
||||
*/
|
||||
private $composerFilesystem;
|
||||
/**
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20211103\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e', false) && !interface_exists('ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e', false) && !trait_exists('ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e', false)) {
|
||||
spl_autoload_call('RectorPrefix20211103\ComposerAutoloaderInitf83c3b4cb9d6183aa3c1d4823093b37e');
|
||||
if (!class_exists('ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857', false) && !interface_exists('ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857', false) && !trait_exists('ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857', false)) {
|
||||
spl_autoload_call('RectorPrefix20211103\ComposerAutoloaderInit6f87d38fbfa82010b9af154bb6015857');
|
||||
}
|
||||
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('RectorPrefix20211103\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20211103\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequiref83c3b4cb9d6183aa3c1d4823093b37e')) {
|
||||
function composerRequiref83c3b4cb9d6183aa3c1d4823093b37e() {
|
||||
return \RectorPrefix20211103\composerRequiref83c3b4cb9d6183aa3c1d4823093b37e(...func_get_args());
|
||||
if (!function_exists('composerRequire6f87d38fbfa82010b9af154bb6015857')) {
|
||||
function composerRequire6f87d38fbfa82010b9af154bb6015857() {
|
||||
return \RectorPrefix20211103\composerRequire6f87d38fbfa82010b9af154bb6015857(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
@ -51,7 +51,7 @@ final class ExtbaseCommandControllerToSymfonyCommandRector extends \Rector\Core\
|
||||
*/
|
||||
private $addCommandsToReturnRector;
|
||||
/**
|
||||
* @var NikicParser
|
||||
* @var \PhpParser\Parser
|
||||
*/
|
||||
private $nikicParser;
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ class PhpDumper extends \RectorPrefix20211103\Symfony\Component\DependencyInject
|
||||
}
|
||||
/**
|
||||
* Sets the dumper to be used when dumping proxies in the generated container.
|
||||
* @param ProxyDumper $proxyDumper
|
||||
* @param \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface $proxyDumper
|
||||
*/
|
||||
public function setProxyDumper($proxyDumper)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user