Updated Rector to commit b56440ac4b137539230a3e907c36f1705c7ed5f4

b56440ac4b allow compatible phpdoc-parser (#3157)
This commit is contained in:
Tomas Votruba 2022-12-05 13:25:12 +00:00
parent b12a622f23
commit 84ab546ff7
10 changed files with 35 additions and 73 deletions

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '3f1a285063f1c40d4c1a2bcdfc7d622ed63d5db6';
public const PACKAGE_VERSION = 'b56440ac4b137539230a3e907c36f1705c7ed5f4';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-05 12:00:28';
public const RELEASE_DATE = '2022-12-05 14:20:01';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitb3f46a8a5e4d96bb2cc58a779cb87e5b
class ComposerAutoloaderInit3d0b5bed2aae45738e69ca7c9f326c63
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitb3f46a8a5e4d96bb2cc58a779cb87e5b
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitb3f46a8a5e4d96bb2cc58a779cb87e5b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit3d0b5bed2aae45738e69ca7c9f326c63', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitb3f46a8a5e4d96bb2cc58a779cb87e5b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit3d0b5bed2aae45738e69ca7c9f326c63', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb3f46a8a5e4d96bb2cc58a779cb87e5b($fileIdentifier, $file);
composerRequire3d0b5bed2aae45738e69ca7c9f326c63($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitb3f46a8a5e4d96bb2cc58a779cb87e5b
* @param string $file
* @return void
*/
function composerRequireb3f46a8a5e4d96bb2cc58a779cb87e5b($fileIdentifier, $file)
function composerRequire3d0b5bed2aae45738e69ca7c9f326c63($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 ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b
class ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3017,9 +3017,9 @@ class ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb3f46a8a5e4d96bb2cc58a779cb87e5b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3d0b5bed2aae45738e69ca7c9f326c63::$classMap;
}, null, ClassLoader::class);
}

View File

@ -685,17 +685,17 @@
},
{
"name": "phpstan\/phpdoc-parser",
"version": "1.14.0",
"version_normalized": "1.14.0.0",
"version": "1.13.1",
"version_normalized": "1.13.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
"reference": "df1a79430e14e30cd192fe6c05842133d076e58d"
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/df1a79430e14e30cd192fe6c05842133d076e58d",
"reference": "df1a79430e14e30cd192fe6c05842133d076e58d",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/aac44118344d197e6d5f7c6cee91885f0a89acdd",
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd",
"shasum": ""
},
"require": {
@ -710,7 +710,7 @@
"phpunit\/phpunit": "^9.5",
"symfony\/process": "^5.2"
},
"time": "2022-11-27T19:09:16+00:00",
"time": "2022-11-20T08:52:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -727,7 +727,7 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.14.0"
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.13.1"
},
"install-path": "..\/phpstan\/phpdoc-parser"
},
@ -2059,12 +2059,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "d789b9089de7b8bab1900214deebef1c62366379"
"reference": "e72f32502fece4fcab4ced8e25559530439595b8"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/d789b9089de7b8bab1900214deebef1c62366379",
"reference": "d789b9089de7b8bab1900214deebef1c62366379",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/e72f32502fece4fcab4ced8e25559530439595b8",
"reference": "e72f32502fece4fcab4ced8e25559530439595b8",
"shasum": ""
},
"require": {
@ -2077,6 +2077,7 @@
},
"require-dev": {
"phpstan\/extension-installer": "^1.2",
"phpstan\/phpdoc-parser": "1.13.1 as 1.14",
"phpstan\/phpstan": "^1.9.2",
"phpstan\/phpstan-webmozart-assert": "^1.2",
"phpunit\/phpunit": "^9.5",
@ -2094,7 +2095,7 @@
"symplify\/rule-doc-generator": "^11.1",
"symplify\/vendor-patches": "^11.1"
},
"time": "2022-12-04T14:02:18+00:00",
"time": "2022-12-05T13:13:51+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -5,39 +5,20 @@ namespace PHPStan\PhpDocParser\Ast\Type;
use PHPStan\PhpDocParser\Ast\NodeAttributes;
use function implode;
use function sprintf;
class GenericTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode
{
public const VARIANCE_INVARIANT = 'invariant';
public const VARIANCE_COVARIANT = 'covariant';
public const VARIANCE_CONTRAVARIANT = 'contravariant';
public const VARIANCE_BIVARIANT = 'bivariant';
use NodeAttributes;
/** @var IdentifierTypeNode */
public $type;
/** @var TypeNode[] */
public $genericTypes;
/** @var (self::VARIANCE_*)[] */
public $variances;
public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $type, array $genericTypes, array $variances = [])
public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $type, array $genericTypes)
{
$this->type = $type;
$this->genericTypes = $genericTypes;
$this->variances = $variances;
}
public function __toString() : string
{
$genericTypes = [];
foreach ($this->genericTypes as $index => $type) {
$variance = $this->variances[$index] ?? self::VARIANCE_INVARIANT;
if ($variance === self::VARIANCE_INVARIANT) {
$genericTypes[] = (string) $type;
} elseif ($variance === self::VARIANCE_BIVARIANT) {
$genericTypes[] = '*';
} else {
$genericTypes[] = sprintf('%s %s', $variance, $type);
}
}
return $this->type . '<' . implode(', ', $genericTypes) . '>';
return $this->type . '<' . implode(', ', $this->genericTypes) . '>';
}
}

View File

@ -238,41 +238,20 @@ class TypeParser
{
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
$genericTypes = [];
$variances = [];
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens);
$genericTypes = [$this->parse($tokens)];
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
// trailing comma case
return new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances);
return new Ast\Type\GenericTypeNode($baseType, $genericTypes);
}
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens);
$genericTypes[] = $this->parse($tokens);
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
}
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
return new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances);
}
/**
* @phpstan-impure
* @return array{Ast\Type\TypeNode, Ast\Type\GenericTypeNode::VARIANCE_*}
*/
public function parseGenericTypeArgument(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : array
{
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_WILDCARD)) {
return [new Ast\Type\IdentifierTypeNode('mixed'), Ast\Type\GenericTypeNode::VARIANCE_BIVARIANT];
}
if ($tokens->tryConsumeTokenValue('contravariant')) {
$variance = Ast\Type\GenericTypeNode::VARIANCE_CONTRAVARIANT;
} elseif ($tokens->tryConsumeTokenValue('covariant')) {
$variance = Ast\Type\GenericTypeNode::VARIANCE_COVARIANT;
} else {
$variance = Ast\Type\GenericTypeNode::VARIANCE_INVARIANT;
}
$type = $this->parse($tokens);
return [$type, $variance];
return new Ast\Type\GenericTypeNode($baseType, $genericTypes);
}
/** @phpstan-impure */
private function parseCallable(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier) : Ast\Type\TypeNode

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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), '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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ddad997'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3d0d84d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d789b90'));
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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), '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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ddad997'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3d0d84d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e72f325'));
private function __construct()
{
}

View File

@ -11,6 +11,7 @@
"require-dev": {
"phpstan\/extension-installer": "^1.2",
"phpstan\/phpstan": "^1.9.2",
"phpstan\/phpdoc-parser": "1.13.1 as 1.14",
"phpstan\/phpstan-webmozart-assert": "^1.2",
"phpunit\/phpunit": "^9.5",
"rector\/rector-debugging": "dev-main",