mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 04:10:51 +00:00
Updated Rector to commit 50e589ca482e73daea8d2d4949c9ec9869fa59a3
50e589ca48
Feature/fix class annotation bad print (#5081)
This commit is contained in:
parent
d99a91176b
commit
000dcd9b3b
|
@ -36,6 +36,8 @@ final class ArrayItemNode implements PhpDocTagValueNode
|
|||
foreach ($this->value as $singleValue) {
|
||||
$value .= $singleValue;
|
||||
}
|
||||
} elseif ($this->value instanceof \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode) {
|
||||
$value .= (string) $this->value->identifierTypeNode . $this->value;
|
||||
} else {
|
||||
$value .= $this->value;
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0.18.4';
|
||||
public const PACKAGE_VERSION = '50e589ca482e73daea8d2d4949c9ec9869fa59a3';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-09-24 19:06:50';
|
||||
public const RELEASE_DATE = '2023-09-26 22:40:27';
|
||||
/**
|
||||
* @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';
|
||||
|
||||
return ComposerAutoloaderInitfb8962cd04c9733c8bc7564499948ec7::getLoader();
|
||||
return ComposerAutoloaderInit616e44b0c32c6966b483f7db34ba7f70::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 ComposerAutoloaderInitfb8962cd04c9733c8bc7564499948ec7
|
||||
class ComposerAutoloaderInit616e44b0c32c6966b483f7db34ba7f70
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitfb8962cd04c9733c8bc7564499948ec7
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfb8962cd04c9733c8bc7564499948ec7', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit616e44b0c32c6966b483f7db34ba7f70', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfb8962cd04c9733c8bc7564499948ec7', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit616e44b0c32c6966b483f7db34ba7f70', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70::$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 ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7
|
||||
class ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -2601,9 +2601,9 @@ class ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitfb8962cd04c9733c8bc7564499948ec7::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit616e44b0c32c6966b483f7db34ba7f70::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
38
vendor/composer/installed.json
vendored
38
vendor/composer/installed.json
vendored
|
@ -504,8 +504,8 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate\/container",
|
||||
"version": "v10.24.0",
|
||||
"version_normalized": "10.24.0.0",
|
||||
"version": "v10.25.0",
|
||||
"version_normalized": "10.25.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/container.git",
|
||||
|
@ -561,8 +561,8 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate\/contracts",
|
||||
"version": "v10.24.0",
|
||||
"version_normalized": "10.24.0.0",
|
||||
"version": "v10.25.0",
|
||||
"version_normalized": "10.25.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/contracts.git",
|
||||
|
@ -858,17 +858,17 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan\/phpdoc-parser",
|
||||
"version": "1.24.1",
|
||||
"version_normalized": "1.24.1.0",
|
||||
"version": "1.24.2",
|
||||
"version_normalized": "1.24.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
||||
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01"
|
||||
"reference": "bcad8d995980440892759db0c32acae7c8e79442"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
|
||||
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/bcad8d995980440892759db0c32acae7c8e79442",
|
||||
"reference": "bcad8d995980440892759db0c32acae7c8e79442",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -885,7 +885,7 @@
|
|||
"phpunit\/phpunit": "^9.5",
|
||||
"symfony\/process": "^5.2"
|
||||
},
|
||||
"time": "2023-09-18T12:18:02+00:00",
|
||||
"time": "2023-09-26T12:28:12+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -902,7 +902,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.24.1"
|
||||
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.24.2"
|
||||
},
|
||||
"install-path": "..\/phpstan\/phpdoc-parser"
|
||||
},
|
||||
|
@ -1873,12 +1873,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "0fe343adc98a0cbadd7d613bb6a579cb15e1b15d"
|
||||
"reference": "d9f1f10f90a779327b0997df543e390a72f90713"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/0fe343adc98a0cbadd7d613bb6a579cb15e1b15d",
|
||||
"reference": "0fe343adc98a0cbadd7d613bb6a579cb15e1b15d",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/d9f1f10f90a779327b0997df543e390a72f90713",
|
||||
"reference": "d9f1f10f90a779327b0997df543e390a72f90713",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1908,7 +1908,7 @@
|
|||
"tomasvotruba\/unused-public": "^0.3",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2023-09-23T12:10:56+00:00",
|
||||
"time": "2023-09-26T10:02:52+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -1944,12 +1944,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "b63fcb21a69b696165deed299530162670283e25"
|
||||
"reference": "b4fc584fa83f9db81e7fcc9c304eedb00393427a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b63fcb21a69b696165deed299530162670283e25",
|
||||
"reference": "b63fcb21a69b696165deed299530162670283e25",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b4fc584fa83f9db81e7fcc9c304eedb00393427a",
|
||||
"reference": "b4fc584fa83f9db81e7fcc9c304eedb00393427a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1982,7 +1982,7 @@
|
|||
"tomasvotruba\/unused-public": "^0.2",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2023-09-23T12:20:24+00:00",
|
||||
"time": "2023-09-25T17:26:18+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -375,7 +375,7 @@ class TypeParser
|
|||
if ($tokens->isCurrentTokenType(Lexer::TOKEN_NULLABLE)) {
|
||||
return $this->parseNullable($tokens);
|
||||
} elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) {
|
||||
$type = $this->parse($tokens);
|
||||
$type = $this->subParse($tokens);
|
||||
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES);
|
||||
if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) {
|
||||
$type = $this->tryParseArrayOrOffsetAccess($tokens, $type);
|
||||
|
|
|
@ -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 3596bbf'), '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 e1b3dab'), '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 0fe343a'), '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 b63fcb2'));
|
||||
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 3596bbf'), '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 e1b3dab'), '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 d9f1f10'), '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 b4fc584'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,20 +3,23 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\PHPUnit\Transform;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ConstFetch;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\DNumber;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
||||
use Rector\PHPUnit\NodeFactory\AssertCallFactory;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\PHPUnit\Tests\Transform\Rector\AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector\AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRectorTest
|
||||
*/
|
||||
final class AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector extends AbstractRector
|
||||
final class AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -45,9 +48,9 @@ $this->assertSame(10, $value);
|
|||
CODE_SAMPLE
|
||||
,
|
||||
<<<'CODE_SAMPLE'
|
||||
$this->assertEqualsWithDelta(10.20, $value, 0.01);
|
||||
$this->assertEqualsWithDelta(10.20, $value, 0.01);
|
||||
$this->assertEqualsWithDelta(10.200, $value, 0.001);
|
||||
$this->assertEqualsWithDelta(10.20, $value, PHP_FLOAT_EPSILON);
|
||||
$this->assertEqualsWithDelta(10.20, $value, PHP_FLOAT_EPSILON);
|
||||
$this->assertEqualsWithDelta(10.200, $value, PHP_FLOAT_EPSILON);
|
||||
$this->assertSame(10, $value);
|
||||
CODE_SAMPLE
|
||||
|
||||
|
@ -76,21 +79,11 @@ CODE_SAMPLE
|
|||
$newMethodCall = $this->assertCallFactory->createCallWithName($node, 'assertEqualsWithDelta');
|
||||
$newMethodCall->args[0] = $args[0];
|
||||
$newMethodCall->args[1] = $args[1];
|
||||
$newMethodCall->args[2] = new Arg(new DNumber($this->generateDelta($firstValue)));
|
||||
$newMethodCall->args[2] = new Arg(new ConstFetch(new Name('PHP_FLOAT_EPSILON')));
|
||||
return $newMethodCall;
|
||||
}
|
||||
private function generateDelta(DNumber $dNumber) : float
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
$rawValueNumber = $dNumber->getAttribute('rawValue');
|
||||
$countDecimals = \strrpos((string) $rawValueNumber, '.');
|
||||
if ($countDecimals === \false) {
|
||||
throw new InvalidArgumentException('First argument passed in the function is not a float.');
|
||||
}
|
||||
$countHowManyDecimals = \strlen((string) $rawValueNumber) - $countDecimals - 2;
|
||||
if ($countHowManyDecimals < 1) {
|
||||
return 0.1;
|
||||
}
|
||||
$mountFloat = \number_format(0.0, $countHowManyDecimals, '.', '0') . '1';
|
||||
return (float) $mountFloat;
|
||||
return PhpVersion::PHP_72;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ CODE_SAMPLE
|
|||
$values = $sensioDoctrineAnnotationTagValueNode->getValues();
|
||||
$symfonyRouteTagValueNode = $this->symfonyRouteTagValueNodeFactory->createFromItems($values);
|
||||
// avoid adding this one
|
||||
if ($node instanceof Class_ && $this->isSingleItemWithDefaultPath($values)) {
|
||||
if ($node instanceof Class_ && $this->isEmptySensioRoute($values)) {
|
||||
continue;
|
||||
}
|
||||
$phpDocInfo->addTagValueNode($symfonyRouteTagValueNode);
|
||||
|
@ -144,8 +144,11 @@ CODE_SAMPLE
|
|||
/**
|
||||
* @param mixed[] $values
|
||||
*/
|
||||
private function isSingleItemWithDefaultPath(array $values) : bool
|
||||
private function isEmptySensioRoute(array $values) : bool
|
||||
{
|
||||
if (\count($values) === 0) {
|
||||
return \true;
|
||||
}
|
||||
if (\count($values) !== 1) {
|
||||
return \false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user