mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit c80cd6f1f03f6f4e1b1aee6504126699e6a06fe3
c80cd6f1f0
[TypeCoverage] Add EmptyOnNullableObjectToInstanceOfRector (#3230)
This commit is contained in:
parent
13fa9d478f
commit
6025307990
@ -26,6 +26,7 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
|
||||
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
|
||||
@ -35,5 +36,5 @@ 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([AddClosureReturnTypeRector::class, AddArrowFunctionReturnTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ArrayShapeFromConstantArrayReturnRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class, AddReturnTypeDeclarationFromYieldsRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictTypedCallRector::class, ReturnNeverTypeRector::class]);
|
||||
$rectorConfig->rules([AddClosureReturnTypeRector::class, AddArrowFunctionReturnTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, ReturnAnnotationIncorrectNullableRector::class, VarAnnotationIncorrectNullableRector::class, ParamAnnotationIncorrectNullableRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, ParamTypeFromStrictTypedPropertyRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromReturnNewRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ArrayShapeFromConstantArrayReturnRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class, AddReturnTypeDeclarationFromYieldsRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictTypedCallRector::class, ReturnNeverTypeRector::class, EmptyOnNullableObjectToInstanceOfRector::class]);
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 414 Rules Overview
|
||||
# 415 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
- [Transform](#transform) (34)
|
||||
|
||||
- [TypeDeclaration](#typedeclaration) (38)
|
||||
- [TypeDeclaration](#typedeclaration) (39)
|
||||
|
||||
- [Visibility](#visibility) (3)
|
||||
|
||||
@ -9170,6 +9170,29 @@ Add array shape exact types based on constant keys of array
|
||||
|
||||
<br>
|
||||
|
||||
### EmptyOnNullableObjectToInstanceOfRector
|
||||
|
||||
Change `empty()` on nullable object to instanceof check
|
||||
|
||||
- class: [`Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector`](../rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run(?AnotherObject $anotherObject)
|
||||
{
|
||||
- if (empty($anotherObject)) {
|
||||
+ if (! $anotherObject instanceof AnotherObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### FalseReturnClassMethodToNullableRector
|
||||
|
||||
Change class method that returns false as invalid state, to nullable
|
||||
|
@ -82,7 +82,7 @@ CODE_SAMPLE
|
||||
$variableName = $this->variableNaming->resolveFromFuncCallFirstArgumentWithSuffix($node, 'Count', 'itemsCount', $scope);
|
||||
return new Variable($variableName);
|
||||
});
|
||||
if ($countInCond === null) {
|
||||
if (!$countInCond instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
if ($variableName === null) {
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Empty_;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
@ -16,6 +15,7 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeCombinator;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
@ -61,31 +61,31 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Identical::class, Empty_::class];
|
||||
return [Identical::class];
|
||||
}
|
||||
/**
|
||||
* @param Identical|Empty_ $node
|
||||
* @param Identical $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node instanceof Identical) {
|
||||
return $this->refactorIdentical($node);
|
||||
}
|
||||
$exprType = $this->getType($node->expr);
|
||||
if (!$exprType instanceof ObjectType) {
|
||||
$expr = $this->matchNullComparedExpr($node);
|
||||
if (!$expr instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
// the empty false positively reports epxr, even if nullable
|
||||
$assign = $this->betterNodeFinder->findPreviousAssignToExpr($node->expr);
|
||||
if (!$assign instanceof Expr) {
|
||||
$assign = $this->getVariableAssign($node, $expr);
|
||||
if (!$assign instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
$previousAssignToExprType = $this->getType($assign);
|
||||
$types = $this->getExactlyTwoUnionedTypes($previousAssignToExprType);
|
||||
if ($this->isNotNullOneOf($types)) {
|
||||
$bareType = $this->matchBareNullableType($expr);
|
||||
if (!$bareType instanceof Type) {
|
||||
return null;
|
||||
}
|
||||
return $this->processConvertToExclusiveType($types, $node->expr);
|
||||
$expression = $assign->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$expression instanceof Expression) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($expression);
|
||||
return $this->processConvertToExclusiveType($bareType, $expr, $phpDocInfo);
|
||||
}
|
||||
private function getVariableAssign(Identical $identical, Expr $expr) : ?Node
|
||||
{
|
||||
@ -96,83 +96,33 @@ CODE_SAMPLE
|
||||
return $this->nodeComparator->areNodesEqual($node->var, $expr);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @return Type[]
|
||||
*/
|
||||
private function getExactlyTwoUnionedTypes(Type $type) : array
|
||||
private function matchBareNullableType(Expr $expr) : ?Type
|
||||
{
|
||||
if (!$type instanceof UnionType) {
|
||||
return [];
|
||||
$exprType = $this->getType($expr);
|
||||
if (!$exprType instanceof UnionType) {
|
||||
return null;
|
||||
}
|
||||
$types = $type->getTypes();
|
||||
if (\count($types) > 2) {
|
||||
return [];
|
||||
if (!TypeCombinator::containsNull($exprType)) {
|
||||
return null;
|
||||
}
|
||||
return $types;
|
||||
if (\count($exprType->getTypes()) !== 2) {
|
||||
return null;
|
||||
}
|
||||
return TypeCombinator::removeNull($exprType);
|
||||
}
|
||||
/**
|
||||
* @param Type[] $types
|
||||
*/
|
||||
private function isNotNullOneOf(array $types) : bool
|
||||
private function processConvertToExclusiveType(Type $type, Expr $expr, PhpDocInfo $phpDocInfo) : ?BooleanNot
|
||||
{
|
||||
if ($types === []) {
|
||||
return \true;
|
||||
}
|
||||
if ($types[0] === $types[1]) {
|
||||
return \true;
|
||||
}
|
||||
if ($types[0] instanceof NullType) {
|
||||
return \false;
|
||||
}
|
||||
return !$types[1] instanceof NullType;
|
||||
}
|
||||
/**
|
||||
* @param Type[] $types
|
||||
*/
|
||||
private function processConvertToExclusiveType(array $types, Expr $expr, ?PhpDocInfo $phpDocInfo = null) : ?BooleanNot
|
||||
{
|
||||
$type = $types[0] instanceof NullType ? $types[1] : $types[0];
|
||||
// $type = $types[0] instanceof NullType ? $types[1] : $types[0];
|
||||
if (!$type instanceof FullyQualifiedObjectType && !$type instanceof ObjectType) {
|
||||
return null;
|
||||
}
|
||||
if ($phpDocInfo instanceof PhpDocInfo) {
|
||||
$varTagValueNode = $phpDocInfo->getVarTagValueNode();
|
||||
if ($varTagValueNode instanceof VarTagValueNode) {
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $varTagValueNode);
|
||||
}
|
||||
$varTagValueNode = $phpDocInfo->getVarTagValueNode();
|
||||
if ($varTagValueNode instanceof VarTagValueNode) {
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $varTagValueNode);
|
||||
}
|
||||
$fullyQualifiedType = $type instanceof ShortenedObjectType ? $type->getFullyQualifiedName() : $type->getClassName();
|
||||
return new BooleanNot(new Instanceof_($expr, new FullyQualified($fullyQualifiedType)));
|
||||
}
|
||||
private function refactorIdentical(Identical $identical) : ?BooleanNot
|
||||
{
|
||||
$expr = $this->matchNullComparedExpr($identical);
|
||||
if (!$expr instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
$node = $this->getVariableAssign($identical, $expr);
|
||||
if (!$node instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
$expression = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$expression instanceof Expression) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($expression);
|
||||
$type = $phpDocInfo->getVarType();
|
||||
if (!$type instanceof UnionType) {
|
||||
$type = $this->getType($node->expr);
|
||||
}
|
||||
if (!$type instanceof UnionType) {
|
||||
return null;
|
||||
}
|
||||
/** @var Type[] $types */
|
||||
$types = $this->getExactlyTwoUnionedTypes($type);
|
||||
if ($this->isNotNullOneOf($types)) {
|
||||
return null;
|
||||
}
|
||||
return $this->processConvertToExclusiveType($types, $expr, $phpDocInfo);
|
||||
}
|
||||
private function matchNullComparedExpr(Identical $identical) : ?Expr
|
||||
{
|
||||
if ($this->valueResolver->isNull($identical->left)) {
|
||||
|
@ -91,7 +91,7 @@ CODE_SAMPLE
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if ($newReturnNode === null) {
|
||||
if (!$newReturnNode instanceof Return_) {
|
||||
return null;
|
||||
}
|
||||
$this->commentsMerger->keepComments($newReturnNode, [$node, $ifInnerNode, $nextNode, $newReturnNode]);
|
||||
|
@ -49,7 +49,7 @@ final class TernaryToNullCoalescingRector extends AbstractRector implements MinP
|
||||
// not a match
|
||||
return null;
|
||||
}
|
||||
if ($checkedNode === null) {
|
||||
if (!$checkedNode instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if (!$fallbackNode instanceof Expr) {
|
||||
|
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\Rector\Empty_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Empty_;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
use PhpParser\Node\Name;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector\EmptyOnNullableObjectToInstanceOfRectorTest
|
||||
*/
|
||||
final class EmptyOnNullableObjectToInstanceOfRector extends AbstractRector
|
||||
{
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Change empty() on nullable object to instanceof check', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run(?AnotherObject $anotherObject)
|
||||
{
|
||||
if (empty($anotherObject)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run(?AnotherObject $anotherObject)
|
||||
{
|
||||
if (! $anotherObject instanceof AnotherObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Empty_::class, BooleanNot::class];
|
||||
}
|
||||
/**
|
||||
* @param Empty_|BooleanNot $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node instanceof BooleanNot) {
|
||||
if (!$node->expr instanceof Empty_) {
|
||||
return null;
|
||||
}
|
||||
$isNegated = \true;
|
||||
$empty = $node->expr;
|
||||
} else {
|
||||
$empty = $node;
|
||||
$isNegated = \false;
|
||||
}
|
||||
$exprType = $this->getType($empty->expr);
|
||||
if (!$exprType instanceof ObjectType) {
|
||||
return null;
|
||||
}
|
||||
$objectType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($exprType, TypeKind::RETURN);
|
||||
if (!$objectType instanceof Name) {
|
||||
return null;
|
||||
}
|
||||
$instanceof = new Instanceof_($empty->expr, $objectType);
|
||||
if ($isNegated) {
|
||||
return $instanceof;
|
||||
}
|
||||
return new BooleanNot($instanceof);
|
||||
}
|
||||
}
|
@ -17,12 +17,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '394fa70c963bb059acd6aae4b998173bdfc6c80c';
|
||||
public const PACKAGE_VERSION = 'c80cd6f1f03f6f4e1b1aee6504126699e6a06fe3';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-12-20 21:36:17';
|
||||
public const RELEASE_DATE = '2022-12-20 22:33:44';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInitbba29df86f92e47d6e1e73b5c11f3ccf::getLoader();
|
||||
return ComposerAutoloaderInitc59c34650e213f2a38f22b4b82bb36db::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2749,6 +2749,7 @@ return array(
|
||||
'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\\Closure\\AddClosureReturnTypeRector' => $baseDir . '/rules/TypeDeclaration/Rector/Closure/AddClosureReturnTypeRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\Empty_\\EmptyOnNullableObjectToInstanceOfRector' => $baseDir . '/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\AddParamTypeSplFixedArrayRector' => $baseDir . '/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\AddReturnTypeDeclarationFromYieldsRector' => $baseDir . '/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\ParamTypeDeclarationRector' => $baseDir . '/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php',
|
||||
|
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 ComposerAutoloaderInitbba29df86f92e47d6e1e73b5c11f3ccf
|
||||
class ComposerAutoloaderInitc59c34650e213f2a38f22b4b82bb36db
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitbba29df86f92e47d6e1e73b5c11f3ccf
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitbba29df86f92e47d6e1e73b5c11f3ccf', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc59c34650e213f2a38f22b4b82bb36db', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitbba29df86f92e47d6e1e73b5c11f3ccf', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc59c34650e213f2a38f22b4b82bb36db', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db::$files;
|
||||
$requireFile = static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$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;
|
||||
|
||||
class ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf
|
||||
class ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -2994,6 +2994,7 @@ class ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf
|
||||
'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\\Closure\\AddClosureReturnTypeRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Closure/AddClosureReturnTypeRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\Empty_\\EmptyOnNullableObjectToInstanceOfRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\AddParamTypeSplFixedArrayRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\AddReturnTypeDeclarationFromYieldsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\FunctionLike\\ParamTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php',
|
||||
@ -3058,9 +3059,9 @@ class ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitbba29df86f92e47d6e1e73b5c11f3ccf::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitc59c34650e213f2a38f22b4b82bb36db::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
14
vendor/composer/installed.json
vendored
14
vendor/composer/installed.json
vendored
@ -749,17 +749,17 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan\/phpdoc-parser",
|
||||
"version": "1.15.2",
|
||||
"version_normalized": "1.15.2.0",
|
||||
"version": "1.15.3",
|
||||
"version_normalized": "1.15.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
||||
"reference": "5941477f100993652218928039d530b75a13a9ca"
|
||||
"reference": "61800f71a5526081d1b5633766aa88341f1ade76"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/5941477f100993652218928039d530b75a13a9ca",
|
||||
"reference": "5941477f100993652218928039d530b75a13a9ca",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/61800f71a5526081d1b5633766aa88341f1ade76",
|
||||
"reference": "61800f71a5526081d1b5633766aa88341f1ade76",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -774,7 +774,7 @@
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"symfony\/process": "^5.2"
|
||||
},
|
||||
"time": "2022-12-16T06:42:48+00:00",
|
||||
"time": "2022-12-20T20:56:55+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -791,7 +791,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.15.2"
|
||||
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.15.3"
|
||||
},
|
||||
"install-path": "..\/phpstan\/phpdoc-parser"
|
||||
},
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -4,6 +4,7 @@ declare (strict_types=1);
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
class ConstExprArrayItemNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode
|
||||
{
|
||||
use NodeAttributes;
|
||||
@ -19,8 +20,8 @@ class ConstExprArrayItemNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\Cons
|
||||
public function __toString() : string
|
||||
{
|
||||
if ($this->key !== null) {
|
||||
return "{$this->key} => {$this->value}";
|
||||
return sprintf('%s => %s', $this->key, $this->value);
|
||||
}
|
||||
return "{$this->value}";
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user