Updated Rector to commit ae3608b3d6464b63a041dd5e779c7b4e8f4cedb6

ae3608b3d6 Remove ununnecesary markAsChanged() in PhpDocTypeChanger, print docblock in explicit way when changed (#4983)
This commit is contained in:
Tomas Votruba 2023-09-11 09:47:14 +00:00
parent 282e5517d7
commit 4c20b79d3c
23 changed files with 50 additions and 45 deletions

View File

@ -27,7 +27,7 @@ final class RectorWithLineChange implements SerializableInterface
*/
private $rectorClass;
/**
* @param string|\Rector\Core\Contract\Rector\RectorInterface $rectorClass
* @param class-string<RectorInterface>|RectorInterface $rectorClass
*/
public function __construct($rectorClass, int $line)
{

View File

@ -20,7 +20,7 @@ final class CommentRemover
$this->commentRemovingNodeTraverser = $commentRemovingNodeTraverser;
}
/**
* @param mixed[]|\PhpParser\Node|null $node
* @param Node[]|Node|null $node
* @return Node[]|null
*/
public function removeFromNode($node) : ?array

View File

@ -59,7 +59,7 @@ final class NodeNameResolver
return \false;
}
/**
* @param \PhpParser\Node|mixed[] $node
* @param Node|Node[] $node
*/
public function isName($node, string $name) : bool
{

View File

@ -15,7 +15,7 @@ use RectorPrefix202309\Webmozart\Assert\Assert;
final class AttributeArrayNameInliner
{
/**
* @param \PhpParser\Node\Expr\Array_|mixed[] $array
* @param Array_|Arg[] $array
* @return Arg[]
*/
public function inlineArrayToArgs($array) : array

View File

@ -13,7 +13,7 @@ final class SimpleCallableNodeTraverser
{
/**
* @param callable(Node $node): (int|Node|null) $callable
* @param \PhpParser\Node|mixed[]|null $node
* @param Node|Node[]|null $node
*/
public function traverseNodesWithCallable($node, callable $callable) : void
{

View File

@ -9,7 +9,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
final class CreatedByRuleDecorator
{
/**
* @param mixed[]|\PhpParser\Node $node
* @param array<Node>|Node $node
* @param class-string<RectorInterface> $rectorClass
*/
public function decorate($node, Node $originalNode, string $rectorClass) : void

View File

@ -25,7 +25,7 @@ final class NodeComparator
}
/**
* Removes all comments from both nodes
* @param \PhpParser\Node|mixed[]|null $node
* @param Node|Node[]|null $node
*/
public function printWithoutComments($node) : string
{
@ -34,8 +34,8 @@ final class NodeComparator
return \trim($content);
}
/**
* @param \PhpParser\Node|mixed[]|null $firstNode
* @param \PhpParser\Node|mixed[]|null $secondNode
* @param Node|Node[]|null $firstNode
* @param Node|Node[]|null $secondNode
*/
public function areNodesEqual($firstNode, $secondNode) : bool
{

View File

@ -52,7 +52,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param array<class-string<T>> $types
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[]|Stmt[] $nodes
* @return T[]
*/
public function findInstancesOf($nodes, array $types) : array
@ -67,7 +67,7 @@ final class BetterNodeFinder
/**
* @template T of Node
* @param class-string<T> $type
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[]|Stmt[] $nodes
* @return T[]
*/
public function findInstanceOf($nodes, string $type) : array
@ -79,7 +79,7 @@ final class BetterNodeFinder
* @param class-string<T> $type
* @return T|null
*
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
*/
public function findFirstInstanceOf($nodes, string $type) : ?Node
{
@ -104,7 +104,7 @@ final class BetterNodeFinder
}
/**
* @api
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @return Variable|null
*/
public function findVariableOfName($nodes, string $name) : ?Node
@ -112,7 +112,7 @@ final class BetterNodeFinder
return $this->findInstanceOfName($nodes, Variable::class, $name);
}
/**
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @param array<class-string<Node>> $types
*/
public function hasInstancesOf($nodes, array $types) : bool
@ -128,7 +128,7 @@ final class BetterNodeFinder
return \false;
}
/**
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @param callable(Node $node): bool $filter
* @return Node[]
*/
@ -149,7 +149,7 @@ final class BetterNodeFinder
});
}
/**
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @param callable(Node $filter): bool $filter
*/
public function findFirst($nodes, callable $filter) : ?Node
@ -249,7 +249,7 @@ final class BetterNodeFinder
}
/**
* @template T of Node
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @param class-string<T> $type
*/
private function findInstanceOfName($nodes, string $type, string $name) : ?Node

View File

@ -87,7 +87,7 @@ final class BetterStandardPrinter extends Standard
return $content;
}
/**
* @param \PhpParser\Node|mixed[]|null $node
* @param Node|Node[]|null $node
*/
public function print($node) : string
{

View File

@ -227,7 +227,7 @@ CODE_SAMPLE;
return $this->nodeTypeResolver->getType($node);
}
/**
* @param \PhpParser\Node|mixed[] $nodes
* @param Node|Node[] $nodes
* @param callable(Node $node): (Node|null|int) $callable
*/
protected function traverseNodesWithCallable($nodes, callable $callable) : void
@ -267,7 +267,7 @@ CODE_SAMPLE;
});
}
/**
* @param \PhpParser\Node|mixed[]|int $refactoredNode
* @param Node|Node[] $refactoredNode
*/
private function postRefactorProcess(Node $originalNode, Node $node, $refactoredNode, string $filePath) : Node
{
@ -291,7 +291,7 @@ CODE_SAMPLE;
return $refactoredNode;
}
/**
* @param mixed[]|\PhpParser\Node $node
* @param Node[]|Node $node
*/
private function refreshScopeNodes($node, string $filePath, ?MutatingScope $mutatingScope) : void
{

View File

@ -19,7 +19,7 @@ if (!\function_exists('dump_node')) {
}
if (!\function_exists('print_node')) {
/**
* @param \PhpParser\Node|mixed[] $node
* @param Node|Node[] $node
*/
function print_node($node) : void
{

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit020430003e086298018f54e93184b9ee
class ComposerAutoloaderInit986975f6401a354acd7ef5005879943b
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit020430003e086298018f54e93184b9ee
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit020430003e086298018f54e93184b9ee', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit986975f6401a354acd7ef5005879943b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit020430003e086298018f54e93184b9ee', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit986975f6401a354acd7ef5005879943b', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit020430003e086298018f54e93184b9ee::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit986975f6401a354acd7ef5005879943b::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit020430003e086298018f54e93184b9ee::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit986975f6401a354acd7ef5005879943b::$files;
$requireFile = \Closure::bind(static function ($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 ComposerStaticInit020430003e086298018f54e93184b9ee
class ComposerStaticInit986975f6401a354acd7ef5005879943b
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2594,9 +2594,9 @@ class ComposerStaticInit020430003e086298018f54e93184b9ee
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit020430003e086298018f54e93184b9ee::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit020430003e086298018f54e93184b9ee::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit020430003e086298018f54e93184b9ee::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit986975f6401a354acd7ef5005879943b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit986975f6401a354acd7ef5005879943b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit986975f6401a354acd7ef5005879943b::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1807,12 +1807,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "fa41cc710a086d98e3e5b908ce3d5484faa621df"
"reference": "74058c221f6156f18958919b0c36a08a281ee919"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/fa41cc710a086d98e3e5b908ce3d5484faa621df",
"reference": "fa41cc710a086d98e3e5b908ce3d5484faa621df",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/74058c221f6156f18958919b0c36a08a281ee919",
"reference": "74058c221f6156f18958919b0c36a08a281ee919",
"shasum": ""
},
"require": {
@ -1839,7 +1839,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-09T10:26:17+00:00",
"time": "2023-09-11T09:43:50+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 41cefd3'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main fa41cc7'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 5629065'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 44e77e5'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 41cefd3'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 74058c2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 5629065'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 44e77e5'));
private function __construct()
{
}

View File

@ -14,6 +14,6 @@ final class FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer
if (isset($oldTokens[$nextTokenPosition]) && $oldTokens[$nextTokenPosition] === ';') {
++$nextTokenPosition;
}
return !isset($oldTokens[$nextTokenPosition]) || isset($oldTokens[$nextTokenPosition][1]) && \strncmp((string) $oldTokens[$nextTokenPosition][1], "\n", \strlen("\n")) === 0;
return !isset($oldTokens[$nextTokenPosition]) || isset($oldTokens[$nextTokenPosition][1]) && \strncmp($oldTokens[$nextTokenPosition][1], "\n", \strlen("\n")) === 0;
}
}

View File

@ -87,7 +87,7 @@ final class ExprInTopStmtMatcher
return $this->resolveExpr($stmt, $stmt->expr, $filter);
}
/**
* @param mixed[]|\PhpParser\Node\Expr $exprs
* @param Expr[]|Expr $exprs
* @param callable(Node $node): bool $filter
* @param \Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface|\PhpParser\Node\Stmt\Switch_|\PhpParser\Node\Stmt\Return_|\PhpParser\Node\Stmt\Expression|\PhpParser\Node\Stmt\Echo_ $stmt
*/

View File

@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ThisType;
use PHPStan\Type\Type;
@ -223,10 +224,14 @@ final class PhpDocFromTypeDeclarationDecorator
*/
private function moveParamTypeToParamDoc($functionLike, Param $param, Type $type) : void
{
$param->type = null;
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
$paramName = $this->nodeNameResolver->getName($param);
$phpDocParamType = $phpDocInfo->getParamType($paramName);
if (!$type instanceof MixedType && \get_class($type) === \get_class($phpDocParamType)) {
return;
}
$this->phpDocTypeChanger->changeParamType($functionLike, $phpDocInfo, $type, $param, $paramName);
$param->type = null;
}
/**
* @param array<class-string<Type>> $requiredTypes

View File

@ -50,7 +50,7 @@ class InputArgument
* @param string $name The argument name
* @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY
* @param string $description A description text
* @param string|bool|int|float|mixed[] $default The default value (for self::OPTIONAL mode only)
* @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*
* @throws InvalidArgumentException When argument mode is not valid

View File

@ -68,9 +68,9 @@ class InputOption
*/
private $description;
/**
* @param string|mixed[] $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param int|null $mode The option mode: One of the VALUE_* constants
* @param string|bool|int|float|mixed[] $default The default value (must be null for self::VALUE_NONE)
* @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*
* @throws InvalidArgumentException If option mode is invalid or incompatible

View File

@ -61,7 +61,7 @@ class Question
private $multiline = \false;
/**
* @param string $question The question to ask to the user
* @param string|bool|int|float $default The default answer to return if the user enters nothing
* @param string|bool|int|float|null $default The default answer to return if the user enters nothing
*/
public function __construct(string $question, $default = null)
{