mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit f20fd6e9daf997a2116f34a305d2c9afa72d393a
f20fd6e9da
Bump phpdoc-parser to 1.15.0 (#3194)
This commit is contained in:
parent
12fbd94766
commit
a6cbd606d0
@ -17,12 +17,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '30bc9ac21ab0e2acbd617954ed6358557514e188';
|
public const PACKAGE_VERSION = 'f20fd6e9daf997a2116f34a305d2c9afa72d393a';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2022-12-13 13:52:32';
|
public const RELEASE_DATE = '2022-12-13 15:50:29';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
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';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c::getLoader();
|
return ComposerAutoloaderInit72e493973b590195b10f494e81373454::getLoader();
|
||||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -81,6 +81,7 @@ return array(
|
|||||||
'PHPStan\\Rules\\PHPUnit\\CoversHelper' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/CoversHelper.php',
|
'PHPStan\\Rules\\PHPUnit\\CoversHelper' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/CoversHelper.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\DataProviderDeclarationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDeclarationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\DataProviderDeclarationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDeclarationRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\DataProviderHelper' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelper.php',
|
'PHPStan\\Rules\\PHPUnit\\DataProviderHelper' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelper.php',
|
||||||
|
'PHPStan\\Rules\\PHPUnit\\DataProviderHelperFactory' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelperFactory.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\MockMethodCallRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/MockMethodCallRule.php',
|
'PHPStan\\Rules\\PHPUnit\\MockMethodCallRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/MockMethodCallRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInClassAnnotationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInClassAnnotationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInClassAnnotationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInClassAnnotationRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInMethodAnnotationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInMethodAnnotationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInMethodAnnotationRule' => $vendorDir . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInMethodAnnotationRule.php',
|
||||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c
|
class ComposerAutoloaderInit72e493973b590195b10f494e81373454
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit72e493973b590195b10f494e81373454', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit72e493973b590195b10f494e81373454', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit0946be413470b7468a3c282fe54e525c::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit72e493973b590195b10f494e81373454::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$includeFiles = \Composer\Autoload\ComposerStaticInit0946be413470b7468a3c282fe54e525c::$files;
|
$includeFiles = \Composer\Autoload\ComposerStaticInit72e493973b590195b10f494e81373454::$files;
|
||||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
composerRequire0946be413470b7468a3c282fe54e525c($fileIdentifier, $file);
|
composerRequire72e493973b590195b10f494e81373454($fileIdentifier, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInit0946be413470b7468a3c282fe54e525c
|
|||||||
* @param string $file
|
* @param string $file
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function composerRequire0946be413470b7468a3c282fe54e525c($fileIdentifier, $file)
|
function composerRequire72e493973b590195b10f494e81373454($fileIdentifier, $file)
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit0946be413470b7468a3c282fe54e525c
|
class ComposerStaticInit72e493973b590195b10f494e81373454
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -321,6 +321,7 @@ class ComposerStaticInit0946be413470b7468a3c282fe54e525c
|
|||||||
'PHPStan\\Rules\\PHPUnit\\CoversHelper' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/CoversHelper.php',
|
'PHPStan\\Rules\\PHPUnit\\CoversHelper' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/CoversHelper.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\DataProviderDeclarationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDeclarationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\DataProviderDeclarationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDeclarationRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\DataProviderHelper' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelper.php',
|
'PHPStan\\Rules\\PHPUnit\\DataProviderHelper' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelper.php',
|
||||||
|
'PHPStan\\Rules\\PHPUnit\\DataProviderHelperFactory' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelperFactory.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\MockMethodCallRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/MockMethodCallRule.php',
|
'PHPStan\\Rules\\PHPUnit\\MockMethodCallRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/MockMethodCallRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInClassAnnotationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInClassAnnotationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInClassAnnotationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInClassAnnotationRule.php',
|
||||||
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInMethodAnnotationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInMethodAnnotationRule.php',
|
'PHPStan\\Rules\\PHPUnit\\NoMissingSpaceInMethodAnnotationRule' => __DIR__ . '/..' . '/phpstan/phpstan-phpunit/src/Rules/PHPUnit/NoMissingSpaceInMethodAnnotationRule.php',
|
||||||
@ -3027,9 +3028,9 @@ class ComposerStaticInit0946be413470b7468a3c282fe54e525c
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0946be413470b7468a3c282fe54e525c::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit72e493973b590195b10f494e81373454::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit0946be413470b7468a3c282fe54e525c::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit72e493973b590195b10f494e81373454::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit0946be413470b7468a3c282fe54e525c::$classMap;
|
$loader->classMap = ComposerStaticInit72e493973b590195b10f494e81373454::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
28
vendor/composer/installed.json
vendored
28
vendor/composer/installed.json
vendored
@ -685,17 +685,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan\/phpdoc-parser",
|
"name": "phpstan\/phpdoc-parser",
|
||||||
"version": "1.13.1",
|
"version": "1.15.0",
|
||||||
"version_normalized": "1.13.1.0",
|
"version_normalized": "1.15.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
||||||
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd"
|
"reference": "6ff970a7101acfe99b3048e4bbfbc094e55c5b04"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/aac44118344d197e6d5f7c6cee91885f0a89acdd",
|
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/6ff970a7101acfe99b3048e4bbfbc094e55c5b04",
|
||||||
"reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd",
|
"reference": "6ff970a7101acfe99b3048e4bbfbc094e55c5b04",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -710,7 +710,7 @@
|
|||||||
"phpunit\/phpunit": "^9.5",
|
"phpunit\/phpunit": "^9.5",
|
||||||
"symfony\/process": "^5.2"
|
"symfony\/process": "^5.2"
|
||||||
},
|
},
|
||||||
"time": "2022-11-20T08:52:26+00:00",
|
"time": "2022-12-07T16:12:39+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -727,7 +727,7 @@
|
|||||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
|
"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.15.0"
|
||||||
},
|
},
|
||||||
"install-path": "..\/phpstan\/phpdoc-parser"
|
"install-path": "..\/phpstan\/phpdoc-parser"
|
||||||
},
|
},
|
||||||
@ -795,17 +795,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan\/phpstan-phpunit",
|
"name": "phpstan\/phpstan-phpunit",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"version_normalized": "1.3.1.0",
|
"version_normalized": "1.3.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/phpstan\/phpstan-phpunit.git",
|
"url": "https:\/\/github.com\/phpstan\/phpstan-phpunit.git",
|
||||||
"reference": "b9827cf8df2bd97c7c07b1bb27c694ee41052754"
|
"reference": "cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/b9827cf8df2bd97c7c07b1bb27c694ee41052754",
|
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088",
|
||||||
"reference": "b9827cf8df2bd97c7c07b1bb27c694ee41052754",
|
"reference": "cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -821,7 +821,7 @@
|
|||||||
"phpstan\/phpstan-strict-rules": "^1.0",
|
"phpstan\/phpstan-strict-rules": "^1.0",
|
||||||
"phpunit\/phpunit": "^9.5"
|
"phpunit\/phpunit": "^9.5"
|
||||||
},
|
},
|
||||||
"time": "2022-12-12T21:02:25+00:00",
|
"time": "2022-12-13T15:08:22+00:00",
|
||||||
"type": "phpstan-extension",
|
"type": "phpstan-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
"phpstan": {
|
"phpstan": {
|
||||||
@ -844,7 +844,7 @@
|
|||||||
"description": "PHPUnit extensions and rules for PHPStan",
|
"description": "PHPUnit extensions and rules for PHPStan",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/issues",
|
"issues": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/issues",
|
||||||
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.1"
|
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.2"
|
||||||
},
|
},
|
||||||
"install-path": "..\/phpstan\/phpstan-phpunit"
|
"install-path": "..\/phpstan\/phpstan-phpunit"
|
||||||
},
|
},
|
||||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -5,6 +5,7 @@ namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
|||||||
|
|
||||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||||
|
use function count;
|
||||||
use function implode;
|
use function implode;
|
||||||
class MethodTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode
|
class MethodTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode
|
||||||
{
|
{
|
||||||
@ -15,17 +16,20 @@ class MethodTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagVa
|
|||||||
public $returnType;
|
public $returnType;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $methodName;
|
public $methodName;
|
||||||
|
/** @var TemplateTagValueNode[] */
|
||||||
|
public $templateTypes;
|
||||||
/** @var MethodTagValueParameterNode[] */
|
/** @var MethodTagValueParameterNode[] */
|
||||||
public $parameters;
|
public $parameters;
|
||||||
/** @var string (may be empty) */
|
/** @var string (may be empty) */
|
||||||
public $description;
|
public $description;
|
||||||
public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description)
|
public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description, array $templateTypes = [])
|
||||||
{
|
{
|
||||||
$this->isStatic = $isStatic;
|
$this->isStatic = $isStatic;
|
||||||
$this->returnType = $returnType;
|
$this->returnType = $returnType;
|
||||||
$this->methodName = $methodName;
|
$this->methodName = $methodName;
|
||||||
$this->parameters = $parameters;
|
$this->parameters = $parameters;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
$this->templateTypes = $templateTypes;
|
||||||
}
|
}
|
||||||
public function __toString() : string
|
public function __toString() : string
|
||||||
{
|
{
|
||||||
@ -33,6 +37,7 @@ class MethodTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagVa
|
|||||||
$returnType = $this->returnType !== null ? "{$this->returnType} " : '';
|
$returnType = $this->returnType !== null ? "{$this->returnType} " : '';
|
||||||
$parameters = implode(', ', $this->parameters);
|
$parameters = implode(', ', $this->parameters);
|
||||||
$description = $this->description !== '' ? " {$this->description}" : '';
|
$description = $this->description !== '' ? " {$this->description}" : '';
|
||||||
return "{$static}{$returnType}{$this->methodName}({$parameters}){$description}";
|
$templateTypes = count($this->templateTypes) > 0 ? '<' . implode(', ', $this->templateTypes) . '>' : '';
|
||||||
|
return "{$static}{$returnType}{$this->methodName}{$templateTypes}({$parameters}){$description}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,20 +5,39 @@ namespace PHPStan\PhpDocParser\Ast\Type;
|
|||||||
|
|
||||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||||
use function implode;
|
use function implode;
|
||||||
|
use function sprintf;
|
||||||
class GenericTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode
|
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;
|
use NodeAttributes;
|
||||||
/** @var IdentifierTypeNode */
|
/** @var IdentifierTypeNode */
|
||||||
public $type;
|
public $type;
|
||||||
/** @var TypeNode[] */
|
/** @var TypeNode[] */
|
||||||
public $genericTypes;
|
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->type = $type;
|
||||||
$this->genericTypes = $genericTypes;
|
$this->genericTypes = $genericTypes;
|
||||||
|
$this->variances = $variances;
|
||||||
}
|
}
|
||||||
public function __toString() : string
|
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) . '>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class PhpDocParser
|
|||||||
case '@template-contravariant':
|
case '@template-contravariant':
|
||||||
case '@phpstan-template-contravariant':
|
case '@phpstan-template-contravariant':
|
||||||
case '@psalm-template-contravariant':
|
case '@psalm-template-contravariant':
|
||||||
$tagValue = $this->parseTemplateTagValue($tokens);
|
$tagValue = $this->parseTemplateTagValue($tokens, \true);
|
||||||
break;
|
break;
|
||||||
case '@extends':
|
case '@extends':
|
||||||
case '@phpstan-extends':
|
case '@phpstan-extends':
|
||||||
@ -268,6 +268,13 @@ class PhpDocParser
|
|||||||
// will throw exception
|
// will throw exception
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$templateTypes = [];
|
||||||
|
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET)) {
|
||||||
|
do {
|
||||||
|
$templateTypes[] = $this->parseTemplateTagValue($tokens, \false);
|
||||||
|
} while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA));
|
||||||
|
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
|
||||||
|
}
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES);
|
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES);
|
||||||
if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) {
|
if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) {
|
||||||
@ -278,7 +285,7 @@ class PhpDocParser
|
|||||||
}
|
}
|
||||||
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES);
|
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES);
|
||||||
$description = $this->parseOptionalDescription($tokens);
|
$description = $this->parseOptionalDescription($tokens);
|
||||||
return new Ast\PhpDoc\MethodTagValueNode($isStatic, $returnType, $methodName, $parameters, $description);
|
return new Ast\PhpDoc\MethodTagValueNode($isStatic, $returnType, $methodName, $parameters, $description, $templateTypes);
|
||||||
}
|
}
|
||||||
private function parseMethodTagValueParameter(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\MethodTagValueParameterNode
|
private function parseMethodTagValueParameter(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\MethodTagValueParameterNode
|
||||||
{
|
{
|
||||||
@ -302,7 +309,7 @@ class PhpDocParser
|
|||||||
}
|
}
|
||||||
return new Ast\PhpDoc\MethodTagValueParameterNode($parameterType, $isReference, $isVariadic, $parameterName, $defaultValue);
|
return new Ast\PhpDoc\MethodTagValueParameterNode($parameterType, $isReference, $isVariadic, $parameterName, $defaultValue);
|
||||||
}
|
}
|
||||||
private function parseTemplateTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\TemplateTagValueNode
|
private function parseTemplateTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, bool $parseDescription) : Ast\PhpDoc\TemplateTagValueNode
|
||||||
{
|
{
|
||||||
$name = $tokens->currentTokenValue();
|
$name = $tokens->currentTokenValue();
|
||||||
$tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER);
|
$tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER);
|
||||||
@ -316,7 +323,11 @@ class PhpDocParser
|
|||||||
} else {
|
} else {
|
||||||
$default = null;
|
$default = null;
|
||||||
}
|
}
|
||||||
$description = $this->parseOptionalDescription($tokens);
|
if ($parseDescription) {
|
||||||
|
$description = $this->parseOptionalDescription($tokens);
|
||||||
|
} else {
|
||||||
|
$description = '';
|
||||||
|
}
|
||||||
return new Ast\PhpDoc\TemplateTagValueNode($name, $bound, $description, $default);
|
return new Ast\PhpDoc\TemplateTagValueNode($name, $bound, $description, $default);
|
||||||
}
|
}
|
||||||
private function parseExtendsTagValue(string $tagName, \PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PhpDocTagValueNode
|
private function parseExtendsTagValue(string $tagName, \PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PhpDocTagValueNode
|
||||||
|
@ -238,20 +238,41 @@ class TypeParser
|
|||||||
{
|
{
|
||||||
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
|
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
$genericTypes = [$this->parse($tokens)];
|
$genericTypes = [];
|
||||||
|
$variances = [];
|
||||||
|
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens);
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
|
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
|
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
|
||||||
// trailing comma case
|
// 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->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
|
$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 */
|
/** @phpstan-impure */
|
||||||
private function parseCallable(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier) : Ast\Type\TypeNode
|
private function parseCallable(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier) : Ast\Type\TypeNode
|
||||||
|
@ -57,6 +57,9 @@ services:
|
|||||||
class: PHPStan\Rules\PHPUnit\AnnotationHelper
|
class: PHPStan\Rules\PHPUnit\AnnotationHelper
|
||||||
-
|
-
|
||||||
class: PHPStan\Rules\PHPUnit\DataProviderHelper
|
class: PHPStan\Rules\PHPUnit\DataProviderHelper
|
||||||
|
factory: @PHPStan\Rules\PHPUnit\DataProviderHelperFactory::create()
|
||||||
|
-
|
||||||
|
class: PHPStan\Rules\PHPUnit\DataProviderHelperFactory
|
||||||
|
|
||||||
conditionalTags:
|
conditionalTags:
|
||||||
PHPStan\PhpDoc\PHPUnit\MockObjectTypeNodeResolverExtension:
|
PHPStan\PhpDoc\PHPUnit\MockObjectTypeNodeResolverExtension:
|
||||||
|
@ -24,9 +24,12 @@ class DataProviderHelper
|
|||||||
* @var ReflectionProvider
|
* @var ReflectionProvider
|
||||||
*/
|
*/
|
||||||
private $reflectionProvider;
|
private $reflectionProvider;
|
||||||
public function __construct(ReflectionProvider $reflectionProvider)
|
/** @var bool */
|
||||||
|
private $phpunit10OrNewer;
|
||||||
|
public function __construct(ReflectionProvider $reflectionProvider, bool $phpunit10OrNewer)
|
||||||
{
|
{
|
||||||
$this->reflectionProvider = $reflectionProvider;
|
$this->reflectionProvider = $reflectionProvider;
|
||||||
|
$this->phpunit10OrNewer = $phpunit10OrNewer;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return array<PhpDocTagNode>
|
* @return array<PhpDocTagNode>
|
||||||
@ -71,8 +74,8 @@ class DataProviderHelper
|
|||||||
if (!$dataProviderMethodReflection->isPublic()) {
|
if (!$dataProviderMethodReflection->isPublic()) {
|
||||||
$errors[] = RuleErrorBuilder::message(sprintf('@dataProvider %s related method must be public.', $dataProviderValue))->build();
|
$errors[] = RuleErrorBuilder::message(sprintf('@dataProvider %s related method must be public.', $dataProviderValue))->build();
|
||||||
}
|
}
|
||||||
if ($deprecationRulesInstalled && !$dataProviderMethodReflection->isStatic()) {
|
if ($deprecationRulesInstalled && $this->phpunit10OrNewer && !$dataProviderMethodReflection->isStatic()) {
|
||||||
$errors[] = RuleErrorBuilder::message(sprintf('@dataProvider %s related method must be static.', $dataProviderValue))->build();
|
$errors[] = RuleErrorBuilder::message(sprintf('@dataProvider %s related method must be static in PHPUnit 10 and newer.', $dataProviderValue))->build();
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
47
vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelperFactory.php
vendored
Normal file
47
vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderHelperFactory.php
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types=1);
|
||||||
|
namespace PHPStan\Rules\PHPUnit;
|
||||||
|
|
||||||
|
use PHPStan\Reflection\ReflectionProvider;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use function dirname;
|
||||||
|
use function explode;
|
||||||
|
use function file_get_contents;
|
||||||
|
use function is_file;
|
||||||
|
use function json_decode;
|
||||||
|
class DataProviderHelperFactory
|
||||||
|
{
|
||||||
|
/** @var ReflectionProvider */
|
||||||
|
private $reflectionProvider;
|
||||||
|
public function __construct(ReflectionProvider $reflectionProvider)
|
||||||
|
{
|
||||||
|
$this->reflectionProvider = $reflectionProvider;
|
||||||
|
}
|
||||||
|
public function create() : \PHPStan\Rules\PHPUnit\DataProviderHelper
|
||||||
|
{
|
||||||
|
$phpUnit10OrNewer = \false;
|
||||||
|
if ($this->reflectionProvider->hasClass(TestCase::class)) {
|
||||||
|
$testCase = $this->reflectionProvider->getClass(TestCase::class);
|
||||||
|
$file = $testCase->getFileName();
|
||||||
|
if ($file !== null) {
|
||||||
|
$phpUnitRoot = dirname($file, 3);
|
||||||
|
$phpUnitComposer = $phpUnitRoot . '/composer.json';
|
||||||
|
if (is_file($phpUnitComposer)) {
|
||||||
|
$composerJson = @file_get_contents($phpUnitComposer);
|
||||||
|
if ($composerJson !== \false) {
|
||||||
|
$json = json_decode($composerJson, \true);
|
||||||
|
$version = $json['extra']['branch-alias']['dev-main'] ?? null;
|
||||||
|
if ($version !== null) {
|
||||||
|
$majorVersion = (int) explode('.', $version)[0];
|
||||||
|
if ($majorVersion >= 10) {
|
||||||
|
$phpUnit10OrNewer = \true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new \PHPStan\Rules\PHPUnit\DataProviderHelper($this->reflectionProvider, $phpUnit10OrNewer);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user