Updated Rector to commit 9b03d8367cd3c69b36b8b1aedf458b191f46655a

9b03d8367c [TypeDeclaration] Add ReturnUnionTypeRector (#4655)
This commit is contained in:
Tomas Votruba 2023-08-05 10:29:33 +00:00
parent cdee2bcef9
commit 9ccb6367c0
27 changed files with 207 additions and 53 deletions

View File

@ -29,6 +29,7 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
@ -42,6 +43,6 @@ use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodRe
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
use Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([AddArrowFunctionReturnTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, TypedPropertyFromStrictConstructorReadonlyClassRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, ReturnTypeFromStrictParamRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class, AddReturnTypeDeclarationFromYieldsRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictTypedCallRector::class, ReturnNeverTypeRector::class, EmptyOnNullableObjectToInstanceOfRector::class, PropertyTypeFromStrictSetterGetterRector::class, ReturnTypeFromStrictTernaryRector::class, BoolReturnTypeFromStrictScalarReturnsRector::class, NumericReturnTypeFromStrictScalarReturnsRector::class, StrictArrayParamDimFetchRector::class]);
$rectorConfig->rules([AddArrowFunctionReturnTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, TypedPropertyFromStrictConstructorReadonlyClassRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, ReturnTypeFromStrictParamRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class, AddReturnTypeDeclarationFromYieldsRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictTypedCallRector::class, ReturnNeverTypeRector::class, EmptyOnNullableObjectToInstanceOfRector::class, PropertyTypeFromStrictSetterGetterRector::class, ReturnTypeFromStrictTernaryRector::class, BoolReturnTypeFromStrictScalarReturnsRector::class, NumericReturnTypeFromStrictScalarReturnsRector::class, StrictArrayParamDimFetchRector::class, ReturnUnionTypeRector::class]);
$rectorConfig->rule(StrictStringParamConcatRector::class);
};

View File

@ -1,4 +1,4 @@
# 363 Rules Overview
# 364 Rules Overview
<br>
@ -52,7 +52,7 @@
- [Transform](#transform) (22)
- [TypeDeclaration](#typedeclaration) (44)
- [TypeDeclaration](#typedeclaration) (45)
- [Visibility](#visibility) (3)
@ -4855,8 +4855,7 @@ Change `money_format()` to equivalent `number_format()`
```diff
-$value = money_format('%i', $value);
+$roundedValue = round($value, 2, PHP_ROUND_HALF_ODD);
+$value = number_format($roundedValue, 2, '.', '');
+$value = number_format(round($value, 2, PHP_ROUND_HALF_ODD), 2, '.', '');
```
<br>
@ -8186,6 +8185,33 @@ Add return method return type based on strict typed property
<br>
### ReturnUnionTypeRector
Add union return type
- class: [`Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector`](../rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php)
```diff
final class SomeClass
{
- public function getData()
+ public function getData(): null|\DateTime|\stdClass
{
if (rand(0, 1)) {
return null;
}
if (rand(0, 1)) {
return new DateTime('now');
}
return new stdClass;
}
}
```
<br>
### StrictArrayParamDimFetchRector
Add array type based on array dim fetch use

View File

@ -71,6 +71,7 @@ CODE_SAMPLE
}
/**
* @param FuncCall|Expression|Assign|Expr\ArrayItem|Node\Arg $node
* @return null|int|\PhpParser\Node\Stmt\Expression|\PhpParser\Node\Expr\Assign|\PhpParser\Node\Expr\Cast
*/
public function refactor(Node $node)
{

View File

@ -81,7 +81,7 @@ CODE_SAMPLE
/**
* @param StmtsAwareInterface $node
*/
public function refactor(Node $node)
public function refactor(Node $node) : ?StmtsAwareInterface
{
if ($node->stmts === null) {
return null;

View File

@ -8,6 +8,7 @@ use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\List_;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\NodeManipulator\AssignManipulator;
@ -57,6 +58,7 @@ CODE_SAMPLE
}
/**
* @param Expression $node
* @return null|Expression|Stmt[]
*/
public function refactor(Node $node)
{

View File

@ -85,6 +85,7 @@ CODE_SAMPLE
}
/**
* @param Array_ $node
* @return null|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall
*/
public function refactorWithScope(Node $node, Scope $scope)
{

View File

@ -105,7 +105,7 @@ CODE_SAMPLE
/**
* @param Class_ $node
*/
public function refactor(Node $node)
public function refactor(Node $node) : ?Node
{
if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
return null;

View File

@ -0,0 +1,121 @@
<?php
declare (strict_types=1);
namespace Rector\TypeDeclaration\Rector\ClassMethod;
use PhpParser\Node;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PHPStan\Analyser\Scope;
use PHPStan\Type\UnionType;
use Rector\Core\Rector\AbstractScopeAwareRector;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector\ReturnUnionTypeRectorTest
*/
final class ReturnUnionTypeRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
{
/**
* @readonly
* @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer
*/
private $returnTypeInferer;
/**
* @readonly
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard
*/
private $classMethodReturnTypeOverrideGuard;
/**
* @readonly
* @var \Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper
*/
private $unionTypeMapper;
public function __construct(ReturnTypeInferer $returnTypeInferer, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, UnionTypeMapper $unionTypeMapper)
{
$this->returnTypeInferer = $returnTypeInferer;
$this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard;
$this->unionTypeMapper = $unionTypeMapper;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Add union return type', [new CodeSample(<<<'CODE_SAMPLE'
final class SomeClass
{
public function getData()
{
if (rand(0, 1)) {
return null;
}
if (rand(0, 1)) {
return new DateTime('now');
}
return new stdClass;
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
final class SomeClass
{
public function getData(): null|\DateTime|\stdClass
{
if (rand(0, 1)) {
return null;
}
if (rand(0, 1)) {
return new DateTime('now');
}
return new stdClass;
}
}
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [ClassMethod::class, Function_::class, Closure::class];
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::NULLABLE_TYPE;
}
/**
* @param ClassMethod|Function_|Closure $node
*/
public function refactorWithScope(Node $node, Scope $scope) : ?Node
{
if ($node->stmts === null) {
return null;
}
if ($node->returnType instanceof Node) {
return null;
}
if ($node instanceof ClassMethod && $this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($node, $scope)) {
return null;
}
$inferReturnType = $this->returnTypeInferer->inferFunctionLike($node);
if (!$inferReturnType instanceof UnionType) {
return null;
}
$returnType = $this->unionTypeMapper->mapToPhpParserNode($inferReturnType, TypeKind::RETURN);
if (!$returnType instanceof Node) {
return null;
}
$node->returnType = $returnType;
return $node;
}
}

View File

@ -52,7 +52,7 @@ CODE_SAMPLE
/**
* @param Property $node
*/
public function refactorWithScope(Node $node, Scope $scope)
public function refactorWithScope(Node $node, Scope $scope) : ?Node
{
// type is already known
if ($node->type !== null) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '75e46c2ff65a715543aa5354c97e5d43f2a20f6c';
public const PACKAGE_VERSION = '9b03d8367cd3c69b36b8b1aedf458b191f46655a';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-04 18:13:15';
public const RELEASE_DATE = '2023-08-05 11:25:26';
/**
* @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 ComposerAutoloaderInitcea0bac898b9dbcc00f708222b5dba45::getLoader();
return ComposerAutoloaderInit6c4d03d897fd974207e52938cb1891bf::getLoader();

View File

@ -2689,6 +2689,7 @@ return array(
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictParamRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictTypedCallRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictTypedPropertyRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnUnionTypeRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\StrictArrayParamDimFetchRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\StrictStringParamConcatRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php',
'Rector\\TypeDeclaration\\Rector\\Class_\\PropertyTypeFromStrictSetterGetterRector' => $baseDir . '/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcea0bac898b9dbcc00f708222b5dba45
class ComposerAutoloaderInit6c4d03d897fd974207e52938cb1891bf
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcea0bac898b9dbcc00f708222b5dba45
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcea0bac898b9dbcc00f708222b5dba45', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit6c4d03d897fd974207e52938cb1891bf', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitcea0bac898b9dbcc00f708222b5dba45', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit6c4d03d897fd974207e52938cb1891bf', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit6c4d03d897fd974207e52938cb1891bf::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit6c4d03d897fd974207e52938cb1891bf::$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 ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45
class ComposerStaticInit6c4d03d897fd974207e52938cb1891bf
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2943,6 +2943,7 @@ class ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictParamRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictTypedCallRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictTypedPropertyRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnUnionTypeRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\StrictArrayParamDimFetchRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php',
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\StrictStringParamConcatRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php',
'Rector\\TypeDeclaration\\Rector\\Class_\\PropertyTypeFromStrictSetterGetterRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php',
@ -3015,9 +3016,9 @@ class ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcea0bac898b9dbcc00f708222b5dba45::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit6c4d03d897fd974207e52938cb1891bf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6c4d03d897fd974207e52938cb1891bf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6c4d03d897fd974207e52938cb1891bf::$classMap;
}, null, ClassLoader::class);
}

View File

@ -976,17 +976,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.10.26",
"version_normalized": "1.10.26.0",
"version": "1.10.27",
"version_normalized": "1.10.27.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "5d660cbb7e1b89253a47147ae44044f49832351f"
"reference": "a9f44dcea06f59d1363b100bb29f297b311fa640"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/5d660cbb7e1b89253a47147ae44044f49832351f",
"reference": "5d660cbb7e1b89253a47147ae44044f49832351f",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/a9f44dcea06f59d1363b100bb29f297b311fa640",
"reference": "a9f44dcea06f59d1363b100bb29f297b311fa640",
"shasum": ""
},
"require": {
@ -995,7 +995,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-07-19T12:44:37+00:00",
"time": "2023-08-05T09:57:55+00:00",
"bin": [
"phpstan",
"phpstan.phar"

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmS32poACgkQUcZzBf/C
5cCvmg/+JJmyX663fa+FHy7ED2SexVuChivpbp82dyLx1gRAl15rtNG4zjxNRfnW
6GpsysMhKqrN7p6xur18ZkLqdFKAjeNnpTunnh/ADetcrs8wzLNyAy7luQtyXAuj
SOv5f/Yitg9yvZ2GHrbzchQuSjkbUR2KroBYsRhwVTH7pMIgdvysRBYiENfbz350
n91WOCApDnVCygzEhBbhkwA/xklJnUxkRJX3AlbbCwES9K64ELyGd0BqJ1Ohy2a7
4cFjwRJq9/tXf99fyncamN8xyBdvYBXSNRNMPYcjKqKIZCOePlR8Q3b7nt154w+e
w2qnAevOB4dYzJaSjwJlaVQYR1YIQ7NlYkGboONq/lrtJlEejDdiRmGvgHZ8nSYW
Ob2JwqgYDfUPfsnXAwXM+whpUNJi30MDB7MSw3SiDlyw690HheT/DCKOJ9yNUiOB
TSGkbIGW/ASett78gowjwniYdryE5ufUPwZbkSaFC3CDysHfs6Jgc+lxe3wnOHtD
WyPl1TqDRNuLOZ26TgxI3gGEYqMcVDYQfmuiOakoebHx6j0bpvyEaP51j0/JFpu6
okKulXgC1DUluKFWMPhobPQRZ8zC29macnU74JvmJIiUhfiP2Pl16D+XcjFW++zH
EDEghcCdgz0pIF6UI5j02rbNAfu7Oo685pnYeXq0DexgXjqoFOE=
=NF4z
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmTOHQkACgkQUcZzBf/C
5cDbgg/9F8+W1+38zrsKYJmyOUUWwl6hDdjUYtv07edR6JEQApKqZ4/UaLwygSO/
oK7FUE8ZPgeA5/k2Pofr5F2Owx583jXm/HWTcQ2iWLocAfrO4EplDSON1LIufkXZ
AnYL8HQ9SitnfMwZme7CeEskYn9vOg4wqljVZcLDA9tCDp6zcOlenuYkkgasJ9pP
QnlOWJhwfn8W02ZK3th0W+RE/cHuGNHqqTnnsu//eG99WUF6DK7tq8zrQohPoIbV
QGN3JflzmJSLLvSLxZMOm8QBcusycKViKmiDnKnYUguocIWdMhDHDwe5cxboeLyt
gRzkCdIM0lJ542qSDVyv6Jp2XzcfvCKWMUzGniVGlhUkEkotazZCwxOZ86o47CdM
FJApHoejfAFR0R5dYLMSkHNlphudccorUtZEodk7mnkLsHwCsR8fB5V9FTw7QnWJ
yWCDt14xvhSbCmBdSgLPjTvSfdwaAhOuqtb8dwcQ+1LxYh8UgrMxw0sD4JadMXLf
l+BcyPI6I7Lf2WvLyiXTzr2JG3E3aNZzPPp8xnmaGSB8yMSbS2zk4cCrwNKX58IE
FLOpyFtrgK0lNeA6T32AleAe4Srng6GPEoJQBER7dpd7yM3VmUBCN94Ov7RRNk8k
xdftD42RJnpKl7/tkOoeI2iCnR9uzyy6PoSOvLnirAYceWyvCdM=
=IhWk
-----END PGP SIGNATURE-----

View File

@ -76,7 +76,7 @@ final class Parser
$type = Line::REMOVED;
}
$diffLines[] = new Line($type, $match['line']);
($nullsafeVariable4 = $chunk) ? $nullsafeVariable4->setLines($diffLines) : null;
($nullsafeVariable1 = $chunk) ? $nullsafeVariable1->setLines($diffLines) : null;
}
}
$diff->setChunks($chunks);

View File

@ -48,7 +48,7 @@ class DefinitionFileLoader extends FileLoader
$loader = $this;
$path = $this->locator->locate($resource);
$this->setCurrentDir(\dirname($path));
($nullsafeVariable5 = $this->container) ? $nullsafeVariable5->fileExists($path) : null;
($nullsafeVariable4 = $this->container) ? $nullsafeVariable4->fileExists($path) : null;
// the closure forbids access to the private scope in the included file
$load = \Closure::bind(static function ($file) use($loader) {
return include $file;

View File

@ -559,7 +559,7 @@ class Application implements ResetInterface
public function has(string $name) : bool
{
$this->init();
return isset($this->commands[$name]) || (($nullsafeVariable6 = $this->commandLoader) ? $nullsafeVariable6->has($name) : null) && $this->add($this->commandLoader->get($name));
return isset($this->commands[$name]) || (($nullsafeVariable5 = $this->commandLoader) ? $nullsafeVariable5->has($name) : null) && $this->add($this->commandLoader->get($name));
}
/**
* Returns an array of all unique namespaces used by currently registered commands.

View File

@ -459,7 +459,7 @@ class Command
throw new \TypeError(\sprintf('Argument 5 passed to "%s()" must be array or \\Closure, "%s" given.', __METHOD__, \get_debug_type($suggestedValues)));
}
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
($nullsafeVariable7 = $this->fullDefinition) ? $nullsafeVariable7->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)) : null;
($nullsafeVariable6 = $this->fullDefinition) ? $nullsafeVariable6->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)) : null;
return $this;
}
/**
@ -483,7 +483,7 @@ class Command
throw new \TypeError(\sprintf('Argument 5 passed to "%s()" must be array or \\Closure, "%s" given.', __METHOD__, \get_debug_type($suggestedValues)));
}
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues));
($nullsafeVariable8 = $this->fullDefinition) ? $nullsafeVariable8->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues)) : null;
($nullsafeVariable7 = $this->fullDefinition) ? $nullsafeVariable7->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues)) : null;
return $this;
}
/**
@ -582,7 +582,7 @@ class Command
public function getProcessedHelp() : string
{
$name = $this->name;
$isSingleCommand = ($nullsafeVariable9 = $this->application) ? $nullsafeVariable9->isSingleCommand() : null;
$isSingleCommand = ($nullsafeVariable8 = $this->application) ? $nullsafeVariable8->isSingleCommand() : null;
$placeholders = ['%command.name%', '%command.full_name%'];
$replacements = [$name, $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'] . ' ' . $name];
return \str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());

View File

@ -69,7 +69,7 @@ final class CompletionInput extends ArgvInput
$this->completionValue = $relevantToken;
return;
}
if (($nullsafeVariable1 = $option) ? $nullsafeVariable1->acceptValue() : null) {
if (($nullsafeVariable2 = $option) ? $nullsafeVariable2->acceptValue() : null) {
$this->completionType = self::TYPE_OPTION_VALUE;
$this->completionName = $option->getName();
$this->completionValue = $optionValue ?: (\strncmp($optionToken, '--', \strlen('--')) !== 0 ? \substr($optionToken, 2) : '');
@ -80,7 +80,7 @@ final class CompletionInput extends ArgvInput
if ('-' === $previousToken[0] && '' !== \trim($previousToken, '-')) {
// check if previous option accepted a value
$previousOption = $this->getOptionFromToken($previousToken);
if (($nullsafeVariable2 = $previousOption) ? $nullsafeVariable2->acceptValue() : null) {
if (($nullsafeVariable3 = $previousOption) ? $nullsafeVariable3->acceptValue() : null) {
$this->completionType = self::TYPE_OPTION_VALUE;
$this->completionName = $previousOption->getName();
$this->completionValue = $relevantToken;

View File

@ -115,9 +115,9 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
if ($value instanceof Reference) {
$targetId = $this->getDefinitionId((string) $value);
$targetDefinition = null !== $targetId ? $this->container->getDefinition($targetId) : null;
$this->graph->connect($this->currentId, $this->currentDefinition, $targetId, $targetDefinition, $value, $this->lazy || $this->hasProxyDumper && (($nullsafeVariable10 = $targetDefinition) ? $nullsafeVariable10->isLazy() : null), ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), $this->byConstructor);
$this->graph->connect($this->currentId, $this->currentDefinition, $targetId, $targetDefinition, $value, $this->lazy || $this->hasProxyDumper && (($nullsafeVariable4 = $targetDefinition) ? $nullsafeVariable4->isLazy() : null), ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), $this->byConstructor);
if ($inExpression) {
$this->graph->connect('.internal.reference_in_expression', null, $targetId, $targetDefinition, $value, $this->lazy || (($nullsafeVariable11 = $targetDefinition) ? $nullsafeVariable11->isLazy() : null), \true);
$this->graph->connect('.internal.reference_in_expression', null, $targetId, $targetDefinition, $value, $this->lazy || (($nullsafeVariable5 = $targetDefinition) ? $nullsafeVariable5->isLazy() : null), \true);
}
return $value;
}

View File

@ -71,7 +71,7 @@ class DecoratorServicePass extends AbstractRecursivePass
} else {
throw new ServiceNotFoundException($inner, $id);
}
if (($nullsafeVariable3 = $decoratedDefinition) ? $nullsafeVariable3->isSynthetic() : null) {
if (($nullsafeVariable9 = $decoratedDefinition) ? $nullsafeVariable9->isSynthetic() : null) {
throw new InvalidArgumentException(\sprintf('A synthetic service cannot be decorated: service "%s" cannot decorate "%s".', $id, $inner));
}
if (isset($decoratingDefinitions[$inner])) {

View File

@ -1635,7 +1635,7 @@ EOF;
if ($value->hasErrors() && ($e = $value->getErrors())) {
return \sprintf('throw new RuntimeException(%s)', $this->export(\reset($e)));
}
if (($nullsafeVariable4 = $this->definitionVariables) ? $nullsafeVariable4->contains($value) : null) {
if (($nullsafeVariable6 = $this->definitionVariables) ? $nullsafeVariable6->contains($value) : null) {
return $this->dumpValue($this->definitionVariables[$value], $interpolate);
}
if ($value->getMethodCalls()) {

View File

@ -421,7 +421,7 @@ XX
$skip[$refId] = \true;
}
foreach ($val as $k => $v) {
$refId = ($nullsafeVariable5 = \ReflectionReference::fromArrayElement($val, $k)) ? $nullsafeVariable5->getId() : null;
$refId = ($nullsafeVariable10 = \ReflectionReference::fromArrayElement($val, $k)) ? $nullsafeVariable10->getId() : null;
self::traverseValue($v, $callback, $skip, $refId);
}
}