Skip to content

Commit

Permalink
Updated Rector to commit 16680c4f102d8155d94340307e8ec02c03ac42ed
Browse files Browse the repository at this point in the history
rectorphp/rector-src@16680c4 Bump to phpstan/phpdoc-parser:^1.14 (#3153)
  • Loading branch information
TomasVotruba committed Dec 4, 2022
1 parent c390fa8 commit 3d977e0
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '4e9214f313edac16dbb4ff6ac48da2d1d706a360';
public const PACKAGE_VERSION = '16680c4f102d8155d94340307e8ec02c03ac42ed';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-04 14:31:14';
public const RELEASE_DATE = '2022-12-04 22:17:24';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit32a6d9f28bd0bc9893c49fb87a6b80ba::getLoader();
return ComposerAutoloaderInit4d8adf8fe23d7ab9f7c12b048177c6f6::getLoader();
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit32a6d9f28bd0bc9893c49fb87a6b80ba
class ComposerAutoloaderInit4d8adf8fe23d7ab9f7c12b048177c6f6
{
private static $loader;

Expand All @@ -22,19 +22,19 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit32a6d9f28bd0bc9893c49fb87a6b80ba', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit4d8adf8fe23d7ab9f7c12b048177c6f6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit32a6d9f28bd0bc9893c49fb87a6b80ba', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit4d8adf8fe23d7ab9f7c12b048177c6f6', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$includeFiles = \Composer\Autoload\ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire32a6d9f28bd0bc9893c49fb87a6b80ba($fileIdentifier, $file);
composerRequire4d8adf8fe23d7ab9f7c12b048177c6f6($fileIdentifier, $file);
}

return $loader;
Expand All @@ -46,7 +46,7 @@ public static function getLoader()
* @param string $file
* @return void
*/
function composerRequire32a6d9f28bd0bc9893c49fb87a6b80ba($fileIdentifier, $file)
function composerRequire4d8adf8fe23d7ab9f7c12b048177c6f6($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba
class ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -3017,9 +3017,9 @@ class ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit32a6d9f28bd0bc9893c49fb87a6b80ba::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4d8adf8fe23d7ab9f7c12b048177c6f6::$classMap;

}, null, ClassLoader::class);
}
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -685,17 +685,17 @@
},
{
"name": "phpstan\/phpdoc-parser",
"version": "1.13.1",
"version_normalized": "1.13.1.0",
"version": "1.14.0",
"version_normalized": "1.14.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd"
"reference": "df1a79430e14e30cd192fe6c05842133d076e58d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/aac44118344d197e6d5f7c6cee91885f0a89acdd",
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/df1a79430e14e30cd192fe6c05842133d076e58d",
"reference": "df1a79430e14e30cd192fe6c05842133d076e58d",
"shasum": ""
},
"require": {
Expand All @@ -710,7 +710,7 @@
"phpunit\/phpunit": "^9.5",
"symfony\/process": "^5.2"
},
"time": "2022-11-20T08:52:26+00:00",
"time": "2022-11-27T19:09:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -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.13.1"
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.14.0"
},
"install-path": "..\/phpstan\/phpdoc-parser"
},
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,39 @@

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;
public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $type, array $genericTypes)
/** @var (self::VARIANCE_*)[] */
public $variances;
public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $type, array $genericTypes, array $variances = [])
{
$this->type = $type;
$this->genericTypes = $genericTypes;
$this->variances = $variances;
}
public function __toString() : string
{
return $this->type . '<' . implode(', ', $this->genericTypes) . '>';
$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) . '>';
}
}
29 changes: 25 additions & 4 deletions vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,41 @@ public function parseGeneric(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens,
{
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
$genericTypes = [$this->parse($tokens)];
$genericTypes = [];
$variances = [];
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($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);
return new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances);
}
$genericTypes[] = $this->parse($tokens);
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($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);
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];
}
/** @phpstan-impure */
private function parseCallable(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier) : Ast\Type\TypeNode
Expand Down

0 comments on commit 3d977e0

Please sign in to comment.