mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-22 08:25:02 +02:00
Updated Rector to commit 2cf8d837421963a540d2cf6e3b42702b1a8ae09e
2cf8d83742
[TypeDeclaration] Handle fallback from param same type object on ReturnTypeFromReturnNewRector (#5039)
This commit is contained in:
parent
8e037982d6
commit
65c9e5396a
@ -87,10 +87,8 @@ final class AutoloadIncluder
|
||||
if (\in_array($filePath, $this->alreadyLoadedAutoloadFiles, \true)) {
|
||||
return;
|
||||
}
|
||||
/** @var string $realPath always string after file_exists() check */
|
||||
$realPath = \realpath($filePath);
|
||||
if (!\is_string($realPath)) {
|
||||
return;
|
||||
}
|
||||
$this->alreadyLoadedAutoloadFiles[] = $realPath;
|
||||
require_once $filePath;
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ final class ChangedFilesDetector
|
||||
}
|
||||
private function resolvePath(string $filePath) : string
|
||||
{
|
||||
/** @var string|false $realPath */
|
||||
$realPath = \realpath($filePath);
|
||||
if ($realPath === \false) {
|
||||
return $filePath;
|
||||
|
@ -295,7 +295,7 @@ final class RectorConfig extends Container
|
||||
*/
|
||||
private function isRuleNoLongerExists($skipRule) : bool
|
||||
{
|
||||
return \is_string($skipRule) && \strpos($skipRule, '*') === \false && \realpath($skipRule) === \false && \substr_compare($skipRule, 'Rector', -\strlen('Rector')) === 0 && !\class_exists($skipRule);
|
||||
return \is_string($skipRule) && \strpos($skipRule, '*') === \false && \substr_compare($skipRule, 'Rector', -\strlen('Rector')) === 0 && !\is_dir($skipRule) && !\is_file($skipRule) && !\class_exists($skipRule);
|
||||
}
|
||||
/**
|
||||
* @param string[] $values
|
||||
|
@ -14,6 +14,7 @@ final class FnMatchPathNormalizer
|
||||
return '*' . \trim($path, '*') . '*';
|
||||
}
|
||||
if (\strpos($path, '..') !== \false) {
|
||||
/** @var string|false $path */
|
||||
$path = \realpath($path);
|
||||
if ($path === \false) {
|
||||
return '';
|
||||
|
@ -7,10 +7,12 @@ final class RealpathMatcher
|
||||
{
|
||||
public function match(string $matchingPath, string $filePath) : bool
|
||||
{
|
||||
/** @var string|false $realPathMatchingPath */
|
||||
$realPathMatchingPath = \realpath($matchingPath);
|
||||
if (!\is_string($realPathMatchingPath)) {
|
||||
return \false;
|
||||
}
|
||||
/** @var string|false $realpathFilePath */
|
||||
$realpathFilePath = \realpath($filePath);
|
||||
if (!\is_string($realpathFilePath)) {
|
||||
return \false;
|
||||
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
@ -213,7 +214,15 @@ CODE_SAMPLE
|
||||
{
|
||||
$newTypes = [];
|
||||
foreach ($returns as $return) {
|
||||
if (!$return->expr instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if (!$return->expr instanceof New_) {
|
||||
$returnType = $this->nodeTypeResolver->getNativeType($return->expr);
|
||||
if ($returnType instanceof ObjectType) {
|
||||
$newTypes[] = $returnType;
|
||||
continue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
$new = $return->expr;
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c956f862094345e72533d83e629938437bf29a43';
|
||||
public const PACKAGE_VERSION = '2cf8d837421963a540d2cf6e3b42702b1a8ae09e';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-09-17 20:16:42';
|
||||
public const RELEASE_DATE = '2023-09-18 13:12:36';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -34,6 +34,7 @@ final class BootstrapFilesIncluder
|
||||
}
|
||||
private function requireRectorStubs() : void
|
||||
{
|
||||
/** @var false|string $stubsRectorDirectory */
|
||||
$stubsRectorDirectory = \realpath(__DIR__ . '/../../stubs-rector');
|
||||
if ($stubsRectorDirectory === \false) {
|
||||
return;
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitedb0f92e91530e9ec0d0e8514967c6be::getLoader();
|
||||
return ComposerAutoloaderInit30b515138a376fc3fe949fa234dad2a9::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitedb0f92e91530e9ec0d0e8514967c6be
|
||||
class ComposerAutoloaderInit30b515138a376fc3fe949fa234dad2a9
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitedb0f92e91530e9ec0d0e8514967c6be
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitedb0f92e91530e9ec0d0e8514967c6be', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit30b515138a376fc3fe949fa234dad2a9', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitedb0f92e91530e9ec0d0e8514967c6be', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit30b515138a376fc3fe949fa234dad2a9', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit30b515138a376fc3fe949fa234dad2a9::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit30b515138a376fc3fe949fa234dad2a9::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be
|
||||
class ComposerStaticInit30b515138a376fc3fe949fa234dad2a9
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -2593,9 +2593,9 @@ class ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitedb0f92e91530e9ec0d0e8514967c6be::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit30b515138a376fc3fe949fa234dad2a9::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit30b515138a376fc3fe949fa234dad2a9::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit30b515138a376fc3fe949fa234dad2a9::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user