Updated Rector to commit 8648410c86d2775821b15ee20c3665dc1e34a806

8648410c86 [Scoped] Fixing downgrade part 2 (#1597)
This commit is contained in:
Tomas Votruba 2021-12-30 16:07:15 +00:00
parent 486b7bee9f
commit 825d9bd12b
91 changed files with 353 additions and 105 deletions

View File

@ -16,6 +16,7 @@ use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRecto
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
use Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
use Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrContainsRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrEndsWithRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector;
@ -71,4 +72,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
$services->set(\Rector\DowngradePhp80\Rector\ClassMethod\DowngradeRecursiveDirectoryIteratorHasChildrenRector::class);
$services->set(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector::class);
$services->set(\Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector::class);
$services->set(\Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector::class);
};

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\MixedType;
use PHPStan\Type\NeverType;
@ -153,4 +154,10 @@ final class PhpDocTypeChanger
$paramType = $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($varTag, $property);
$this->changeParamType($phpDocInfo, $paramType, $param, $paramVarName);
}
public function changeVarTypeNode(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode) : void
{
// add completely new one
$varTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode($typeNode, '', '');
$phpDocInfo->addTagValueNode($varTagValueNode);
}
}

View File

@ -31,7 +31,7 @@ final class PhpDocNodeMapper
*/
private $cloningPhpDocNodeVisitor;
/**
* @var \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface[]
* @var BasePhpDocNodeVisitorInterface[]
* @readonly
*/
private $phpDocNodeVisitors;

View File

@ -14,6 +14,9 @@ final class CacheItem
* @var string
*/
private $variableKey;
/**
* @var mixed
*/
private $data;
/**
* @param mixed $data

View File

@ -27,7 +27,7 @@ final class FileFormatter
*/
private $parameterProvider;
/**
* @var \Rector\FileFormatter\Contract\Formatter\FileFormatterInterface[]
* @var FileFormatterInterface[]
* @readonly
*/
private $fileFormatters = [];

View File

@ -14,7 +14,7 @@ final class AddedFileWithNodes implements \Rector\FileSystemRector\Contract\Adde
*/
private $filePath;
/**
* @var \PhpParser\Node\Stmt[]
* @var Node\Stmt[]
* @readonly
*/
private $nodes;

View File

@ -42,7 +42,7 @@ final class NodeNameResolver
*/
private $callAnalyzer;
/**
* @var \Rector\NodeNameResolver\Contract\NodeNameResolverInterface[]
* @var NodeNameResolverInterface[]
* @readonly
*/
private $nodeNameResolvers = [];

View File

@ -12,7 +12,7 @@ use Rector\NodeTypeResolver\Contract\SourceLocatorProviderInterface;
final class IntermediateSourceLocator implements \PHPStan\BetterReflection\SourceLocator\Type\SourceLocator
{
/**
* @var \Rector\NodeTypeResolver\Contract\SourceLocatorProviderInterface[]
* @var SourceLocatorProviderInterface[]
* @readonly
*/
private $sourceLocatorProviders;

View File

@ -17,7 +17,7 @@ use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
final class PHPStanStaticTypeMapper
{
/**
* @var \Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface[]
* @var TypeMapperInterface[]
* @readonly
*/
private $typeMappers;

View File

@ -43,6 +43,10 @@ final class BooleanTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contrac
if ($this->isFalseBooleanTypeWithUnion($type)) {
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('false');
}
if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
// cannot be parent of union
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('true');
}
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('bool');
}
/**

View File

@ -19,6 +19,7 @@ use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedGenericObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
use RectorPrefix20211230\Symfony\Contracts\Service\Attribute\Required;
@ -52,6 +53,10 @@ final class ObjectTypeMapper implements \Rector\PHPStanStaticTypeMapper\Contract
if ($type instanceof \PHPStan\Type\Generic\GenericObjectType) {
return $this->mapGenericObjectType($type, $typeKind);
}
if ($type instanceof \Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType) {
// possibly generic type
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode($type->getClassName());
}
return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('\\' . $type->getClassName());
}
/**

View File

@ -12,7 +12,7 @@ use Rector\PhpAttribute\Enum\DocTagNodeState;
final class AnnotationToAttributeMapper
{
/**
* @var \Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface[]
* @var AnnotationToAttributeMapperInterface[]
* @readonly
*/
private $annotationToAttributeMappers;

View File

@ -9,7 +9,7 @@ use Rector\ReadWrite\Contract\ReadNodeAnalyzerInterface;
final class ReadExprAnalyzer
{
/**
* @var \Rector\ReadWrite\Contract\ReadNodeAnalyzerInterface[]
* @var ReadNodeAnalyzerInterface[]
* @readonly
*/
private $readNodeAnalyzers;

View File

@ -15,7 +15,7 @@ use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
final class PhpParserNodeMapper
{
/**
* @var \Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface[]
* @var PhpParserNodeMapperInterface[]
* @readonly
*/
private $phpParserNodeMappers;

View File

@ -15,7 +15,7 @@ use Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface;
final class PhpDocTypeMapper
{
/**
* @var \Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface[]
* @var PhpDocTypeMapperInterface[]
* @readonly
*/
private $phpDocTypeMappers;

View File

@ -37,6 +37,9 @@ final class NullableTypeMapper implements \Rector\StaticTypeMapper\Contract\PhpD
{
return \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class;
}
/**
* @param NullableTypeNode $typeNode
*/
public function mapToPHPStanType(\PHPStan\PhpDocParser\Ast\Type\TypeNode $typeNode, \PhpParser\Node $node, \PHPStan\Analyser\NameScope $nameScope) : \PHPStan\Type\Type
{
$type = $typeNode->type;

View File

@ -23,11 +23,17 @@ final class ReplaceArgumentDefaultValue implements \Rector\Arguments\Contract\Re
*/
private $method;
/**
* @var int
* @var int<0, max>
* @readonly
*/
private $position;
/**
* @var mixed
*/
private $valueBefore;
/**
* @var mixed
*/
private $valueAfter;
/**
* @param int<0, max> $position

View File

@ -16,7 +16,13 @@ final class ReplaceFuncCallArgumentDefaultValue implements \Rector\Arguments\Con
* @var int
*/
private $position;
/**
* @var mixed
*/
private $valueBefore;
/**
* @var mixed
*/
private $valueAfter;
/**
* @param mixed $valueBefore

View File

@ -11,7 +11,7 @@ final class SwapFuncCallArguments
*/
private $function;
/**
* @var int[]
* @var array<int, int>
* @readonly
*/
private $order;

View File

@ -14,6 +14,7 @@ use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Core\Php\PhpVersionProvider;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\Privatization\TypeManipulator\TypeNormalizer;
use Rector\StaticTypeMapper\StaticTypeMapper;
final class PropertyTypeDecorator
{
@ -37,15 +38,23 @@ final class PropertyTypeDecorator
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(\Rector\Core\Php\PhpVersionProvider $phpVersionProvider, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
/**
* @readonly
* @var \Rector\Privatization\TypeManipulator\TypeNormalizer
*/
private $typeNormalizer;
public function __construct(\Rector\Core\Php\PhpVersionProvider $phpVersionProvider, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\Privatization\TypeManipulator\TypeNormalizer $typeNormalizer)
{
$this->phpVersionProvider = $phpVersionProvider;
$this->staticTypeMapper = $staticTypeMapper;
$this->phpDocTypeChanger = $phpDocTypeChanger;
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->typeNormalizer = $typeNormalizer;
}
public function decorateProperty(\PhpParser\Node\Stmt\Property $property, \PHPStan\Type\Type $propertyType) : void
{
// generalize false/true type to bool, as mostly default value but accepts both
$propertyType = $this->typeNormalizer->generalizeConstantBoolTypes($propertyType);
$this->decoratePropertyWithVarDoc($property, $propertyType);
$this->decoratePropertyWithType($property, $propertyType);
}

View File

@ -14,7 +14,7 @@ use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
final class ClassNameImportSkipper
{
/**
* @var \Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface[]
* @var ClassNameImportSkipVoterInterface[]
* @readonly
*/
private $classNameImportSkipVoters;

View File

@ -17,6 +17,7 @@ use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\Privatization\TypeManipulator\TypeNormalizer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -34,10 +35,16 @@ final class VarConstantCommentRector extends \Rector\Core\Rector\AbstractRector
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger
*/
private $phpDocTypeChanger;
public function __construct(\Rector\NodeTypeResolver\TypeComparator\TypeComparator $typeComparator, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger)
/**
* @readonly
* @var \Rector\Privatization\TypeManipulator\TypeNormalizer
*/
private $typeNormalizer;
public function __construct(\Rector\NodeTypeResolver\TypeComparator\TypeComparator $typeComparator, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\Privatization\TypeManipulator\TypeNormalizer $typeNormalizer)
{
$this->typeComparator = $typeComparator;
$this->phpDocTypeChanger = $phpDocTypeChanger;
$this->typeNormalizer = $typeNormalizer;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
@ -77,6 +84,8 @@ CODE_SAMPLE
if ($constType instanceof \PHPStan\Type\MixedType) {
return null;
}
// generalize false/true type to bool, as mostly default value but accepts both
$constType = $this->typeNormalizer->generalizeConstantBoolTypes($constType);
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
if ($this->shouldSkipConstantArrayType($constType, $phpDocInfo)) {
return null;

View File

@ -33,7 +33,7 @@ final class ComposerFileProcessor implements \Rector\Core\Contract\Processor\Fil
*/
private $fileDiffFactory;
/**
* @var \Rector\Composer\Contract\Rector\ComposerRectorInterface[]
* @var ComposerRectorInterface[]
* @readonly
*/
private $composerRectors;

View File

@ -16,6 +16,9 @@ final class BinaryToVersionCompareCondition implements \Rector\DeadCode\Contract
* @var string
*/
private $binaryClass;
/**
* @var mixed
*/
private $expectedValue;
/**
* @param mixed $expectedValue

View File

@ -11,7 +11,7 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Property;
use PHPStan\Type\MixedType;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Core\Exception\ShouldNotHappenException;
@ -201,12 +201,11 @@ CODE_SAMPLE
if ($name === null) {
return;
}
$type = $phpDocInfo->getParamType($name);
// MixedType likely means there was no param type defined
if ($type instanceof \PHPStan\Type\MixedType) {
$paramTagValueNode = $phpDocInfo->getParamTagValueByName($name);
if (!$paramTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
return;
}
$propertyDocInfo = $this->phpDocInfoFactory->createEmpty($property);
$this->phpDocTypeChanger->changeVarType($propertyDocInfo, $type);
$this->phpDocTypeChanger->changeVarTypeNode($propertyDocInfo, $paramTagValueNode->type);
}
}

View File

@ -0,0 +1,136 @@
<?php
declare (strict_types=1);
namespace Rector\DowngradePhp80\Rector\FuncCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\Empty_;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Param;
use PhpParser\Node\Scalar\String_;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://www.php.net/manual/en/function.array-filter.php#refsect1-function.array-filter-changelog
*
* @see \Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector\DowngradeArrayFilterNullableCallbackRectorTest
*/
final class DowngradeArrayFilterNullableCallbackRector extends \Rector\Core\Rector\AbstractRector
{
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Unset nullable callback on array_filter', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
class SomeClass
{
public function run($callback = null)
{
$data = [[]];
var_dump(array_filter($data, null));
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
class SomeClass
{
public function run($callback = null)
{
$data = [[]];
var_dump(array_filter($data));
}
}
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [\PhpParser\Node\Expr\FuncCall::class];
}
/**
* @param FuncCall $node
* @return \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Ternary|null
*/
public function refactor(\PhpParser\Node $node)
{
$args = $node->getArgs();
if (!$this->isName($node, 'array_filter')) {
return null;
}
if ($this->hasNamedArg($args)) {
return null;
}
if (!isset($args[1])) {
return null;
}
$createdByRule = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CREATED_BY_RULE);
if ($createdByRule === self::class) {
return null;
}
// direct null check ConstFetch
if ($args[1]->value instanceof \PhpParser\Node\Expr\ConstFetch && $this->valueResolver->isNull($args[1]->value)) {
$args = [$args[0]];
$node->args = $args;
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CREATED_BY_RULE, self::class);
return $node;
}
if ($this->shouldSkipSecondArg($args[1]->value)) {
return null;
}
$node->args[1] = new \PhpParser\Node\Arg($this->createNewArgFirstTernary($args));
$node->args[2] = new \PhpParser\Node\Arg($this->createNewArgSecondTernary($args));
$node->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CREATED_BY_RULE, self::class);
return $node;
}
private function shouldSkipSecondArg(\PhpParser\Node\Expr $expr) : bool
{
return \in_array(\get_class($expr), [\PhpParser\Node\Scalar\String_::class, \PhpParser\Node\Expr\Closure::class, \PhpParser\Node\Expr\ArrowFunction::class], \true);
}
/**
* @param Arg[] $args
*/
private function createNewArgFirstTernary(array $args) : \PhpParser\Node\Expr\Ternary
{
$identical = new \PhpParser\Node\Expr\BinaryOp\Identical($args[1]->value, $this->nodeFactory->createNull());
$vVariable = new \PhpParser\Node\Expr\Variable('v');
$arrowFunction = new \PhpParser\Node\Expr\ArrowFunction(['expr' => new \PhpParser\Node\Expr\BooleanNot(new \PhpParser\Node\Expr\Empty_($vVariable))]);
$arrowFunction->params = [new \PhpParser\Node\Param($vVariable), new \PhpParser\Node\Param(new \PhpParser\Node\Expr\Variable('k'))];
$arrowFunction->returnType = new \PhpParser\Node\Identifier('bool');
return new \PhpParser\Node\Expr\Ternary($identical, $arrowFunction, $args[1]->value);
}
/**
* @param Arg[] $args
*/
private function createNewArgSecondTernary(array $args) : \PhpParser\Node\Expr\Ternary
{
$identical = new \PhpParser\Node\Expr\BinaryOp\Identical($args[1]->value, $this->nodeFactory->createNull());
$constFetch = new \PhpParser\Node\Expr\ConstFetch(new \PhpParser\Node\Name('ARRAY_FILTER_USE_BOTH'));
return new \PhpParser\Node\Expr\Ternary($identical, $constFetch, isset($args[2]) ? $args[2]->value : new \PhpParser\Node\Expr\ConstFetch(new \PhpParser\Node\Name('0')));
}
/**
* @param Arg[] $args
*/
private function hasNamedArg(array $args) : bool
{
foreach ($args as $arg) {
if ($arg->name instanceof \PhpParser\Node\Identifier) {
return \true;
}
}
return \false;
}
}

View File

@ -36,7 +36,7 @@ final class VariableNaming
*/
private $nodeTypeResolver;
/**
* @var \Rector\Naming\Contract\AssignVariableNameResolverInterface[]
* @var AssignVariableNameResolverInterface[]
* @readonly
*/
private $assignVariableNameResolvers;

View File

@ -8,7 +8,7 @@ use Rector\Naming\Contract\RenameValueObjectInterface;
final class PropertyRenameGuard
{
/**
* @var \Rector\Naming\Contract\Guard\ConflictingNameGuardInterface[]
* @var ConflictingNameGuardInterface[]
* @readonly
*/
private $conflictingNameGuards;

View File

@ -6,12 +6,12 @@ namespace Rector\Order\ValueObject;
final class SortedClassMethodsAndOriginalClassMethods
{
/**
* @var string[]
* @var array<int, string>
* @readonly
*/
private $sortedClassMethods;
/**
* @var string[]
* @var array<int, string>
* @readonly
*/
private $originalClassMethods;

View File

@ -14,7 +14,7 @@ use PhpParser\Node\Expr\Variable;
final class VariableAssignPair
{
/**
* @var ArrayDimFetch|PropertyFetch|StaticPropertyFetch|Variable
* @var Variable|ArrayDimFetch|PropertyFetch|StaticPropertyFetch
* @readonly
*/
private $variable;

View File

@ -24,7 +24,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
final class StrStartsWithRector extends \Rector\Core\Rector\AbstractRector implements \Rector\VersionBonding\Contract\MinPhpVersionInterface
{
/**
* @var \Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface[]
* @var StrStartWithMatchAndRefactorInterface[]
* @readonly
*/
private $strStartWithMatchAndRefactors;

View File

@ -8,7 +8,7 @@ use Rector\Php80\Enum\MatchKind;
final class CondAndExpr
{
/**
* @var \PhpParser\Node\Expr[]|null
* @var Expr[]|null
* @readonly
*/
private $condExprs;

View File

@ -0,0 +1,25 @@
<?php
declare (strict_types=1);
namespace Rector\Privatization\TypeManipulator;
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeTraverser;
final class TypeNormalizer
{
/**
* Generalize false/true type to bool,
* as mostly default value but accepts both
*/
public function generalizeConstantBoolTypes(\PHPStan\Type\Type $type) : \PHPStan\Type\Type
{
return \PHPStan\Type\TypeTraverser::map($type, function (\PHPStan\Type\Type $type, callable $traverseCallback) {
if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
return new \PHPStan\Type\BooleanType();
}
return $traverseCallback($type, $traverseCallback);
});
}
}

View File

@ -22,6 +22,9 @@ final class ArgumentRemover
* @var int
*/
private $position;
/**
* @var mixed
*/
private $value;
/**
* @param mixed $value

View File

@ -23,6 +23,9 @@ final class MethodCallRenameWithArrayKey implements \Rector\Renaming\Contract\Me
* @var string
*/
private $newMethod;
/**
* @var mixed
*/
private $arrayKey;
/**
* @param mixed $arrayKey

View File

@ -24,7 +24,7 @@ final class StaticCallToFuncCallRector extends \Rector\Core\Rector\AbstractRecto
*/
public const STATIC_CALLS_TO_FUNCTIONS = 'static_calls_to_functions';
/**
* @var \Rector\Transform\ValueObject\StaticCallToFuncCall[]
* @var StaticCallToFuncCall[]
*/
private $staticCallsToFunctions = [];
/**

View File

@ -8,22 +8,22 @@ use Rector\Transform\Contract\ValueObject\ArgumentFuncCallToMethodCallInterface;
final class ArrayFuncCallToMethodCall implements \Rector\Transform\Contract\ValueObject\ArgumentFuncCallToMethodCallInterface
{
/**
* @var \non-empty-string
* @var non-empty-string
* @readonly
*/
private $function;
/**
* @var \non-empty-string
* @var non-empty-string
* @readonly
*/
private $class;
/**
* @var \non-empty-string
* @var non-empty-string
* @readonly
*/
private $arrayMethod;
/**
* @var \non-empty-string
* @var non-empty-string
* @readonly
*/
private $nonArrayMethod;

View File

@ -12,6 +12,9 @@ final class NewArgToMethodCall
* @var string
*/
private $type;
/**
* @var mixed
*/
private $value;
/**
* @readonly

View File

@ -21,6 +21,7 @@ use Rector\Core\Rector\AbstractRector;
use Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Privatization\TypeManipulator\NormalizeTypeToRespectArrayScalarType;
use Rector\Privatization\TypeManipulator\TypeNormalizer;
use Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer;
use Rector\TypeDeclaration\TypeAnalyzer\AdvancedArrayAnalyzer;
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
@ -68,7 +69,12 @@ final class AddArrayReturnDocTypeRector extends \Rector\Core\Rector\AbstractRect
* @var \Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer
*/
private $detailedTypeAnalyzer;
public function __construct(\Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer $returnTypeInferer, \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, \Rector\TypeDeclaration\TypeAnalyzer\AdvancedArrayAnalyzer $advancedArrayAnalyzer, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\Privatization\TypeManipulator\NormalizeTypeToRespectArrayScalarType $normalizeTypeToRespectArrayScalarType, \Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover $returnTagRemover, \Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer $detailedTypeAnalyzer)
/**
* @readonly
* @var \Rector\Privatization\TypeManipulator\TypeNormalizer
*/
private $typeNormalizer;
public function __construct(\Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer $returnTypeInferer, \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, \Rector\TypeDeclaration\TypeAnalyzer\AdvancedArrayAnalyzer $advancedArrayAnalyzer, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger $phpDocTypeChanger, \Rector\Privatization\TypeManipulator\NormalizeTypeToRespectArrayScalarType $normalizeTypeToRespectArrayScalarType, \Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover $returnTagRemover, \Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer $detailedTypeAnalyzer, \Rector\Privatization\TypeManipulator\TypeNormalizer $typeNormalizer)
{
$this->returnTypeInferer = $returnTypeInferer;
$this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard;
@ -77,6 +83,7 @@ final class AddArrayReturnDocTypeRector extends \Rector\Core\Rector\AbstractRect
$this->normalizeTypeToRespectArrayScalarType = $normalizeTypeToRespectArrayScalarType;
$this->returnTagRemover = $returnTagRemover;
$this->detailedTypeAnalyzer = $detailedTypeAnalyzer;
$this->typeNormalizer = $typeNormalizer;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
@ -131,6 +138,8 @@ CODE_SAMPLE
}
$inferredReturnType = $this->returnTypeInferer->inferFunctionLikeWithExcludedInferers($node, [\Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer\ReturnTypeDeclarationReturnTypeInfererTypeInferer::class]);
$inferredReturnType = $this->normalizeTypeToRespectArrayScalarType->normalizeToArray($inferredReturnType, $node->returnType);
// generalize false/true type to bool, as mostly default value but accepts both
$inferredReturnType = $this->typeNormalizer->generalizeConstantBoolTypes($inferredReturnType);
$currentReturnType = $phpDocInfo->getReturnType();
if ($this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethodOldTypeWithNewType($currentReturnType, $inferredReturnType)) {
return null;

View File

@ -18,7 +18,7 @@ final class ParamTypeInferer
*/
private $genericClassStringTypeNormalizer;
/**
* @var \Rector\TypeDeclaration\Contract\TypeInferer\ParamTypeInfererInterface[]
* @var ParamTypeInfererInterface[]
* @readonly
*/
private $paramTypeInferers;

View File

@ -19,7 +19,7 @@ final class AddParamTypeDeclaration
*/
private $methodName;
/**
* @var int
* @var int<0, max>
* @readonly
*/
private $position;

View File

@ -102,7 +102,7 @@ final class ApplicationFileProcessor
*/
private $cpuCoreCountProvider;
/**
* @var \Rector\Core\Contract\Processor\FileProcessorInterface[]
* @var FileProcessorInterface[]
* @readonly
*/
private $fileProcessors = [];

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '068369e632408225fe89991c08485ceb07f89664';
public const PACKAGE_VERSION = '8648410c86d2775821b15ee20c3665dc1e34a806';
/**
* @var string
*/
public const RELEASE_DATE = '2021-12-30 15:04:11';
public const RELEASE_DATE = '2021-12-30 15:54:54';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211230\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -35,7 +35,7 @@ final class InitCommand extends \RectorPrefix20211230\Symfony\Component\Console\
*/
private $symfonyStyle;
/**
* @var \Rector\Core\Contract\Template\TemplateResolverInterface[]
* @var TemplateResolverInterface[]
* @readonly
*/
private $templateResolvers;

View File

@ -83,7 +83,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
*/
private $symfonyStyle;
/**
* @var \Rector\Core\Contract\Rector\RectorInterface[]
* @var RectorInterface[]
* @readonly
*/
private $rectors;

View File

@ -18,7 +18,7 @@ final class ShowCommand extends \RectorPrefix20211230\Symfony\Component\Console\
*/
private $outputStyle;
/**
* @var \Rector\Core\Contract\Rector\RectorInterface[]
* @var RectorInterface[]
* @readonly
*/
private $rectors;

View File

@ -15,7 +15,7 @@ use Rector\Parallel\ValueObject\Bridge;
final class NonPhpFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var \Rector\Core\Contract\Rector\NonPhpRectorInterface[]
* @var NonPhpRectorInterface[]
* @readonly
*/
private $nonPhpRectors;

View File

@ -11,7 +11,7 @@ use Rector\Core\Contract\PHPStan\Reflection\TypeToCallReflectionResolver\TypeToC
final class TypeToCallReflectionResolverRegistry
{
/**
* @var \Rector\Core\Contract\PHPStan\Reflection\TypeToCallReflectionResolver\TypeToCallReflectionResolverInterface[]
* @var TypeToCallReflectionResolverInterface[]
* @readonly
*/
private $resolvers;

View File

@ -11,7 +11,7 @@ use PhpParser\NodeAbstract;
final class FileWithoutNamespace extends \PhpParser\NodeAbstract
{
/**
* @var \PhpParser\Node\Stmt[]
* @var Stmt[]
*/
public $stmts;
/**

View File

@ -17,7 +17,7 @@ final class RectorNodeTraverser extends \PhpParser\NodeTraverser
*/
private $areNodeVisitorsPrepared = \false;
/**
* @var \Rector\Core\Contract\Rector\PhpRectorInterface[]
* @var PhpRectorInterface[]
* @readonly
*/
private $phpRectors;

View File

@ -7,7 +7,7 @@ use PhpParser\Node\Stmt;
final class StmtsAndTokens
{
/**
* @var \PhpParser\Node\Stmt[]
* @var Stmt[]
* @readonly
*/
private $stmts;

View File

@ -11,7 +11,7 @@ use RectorPrefix20211230\Symfony\Component\Console\Style\SymfonyStyle;
final class MissingRectorRulesReporter
{
/**
* @var \Rector\Core\Contract\Rector\RectorInterface[]
* @var RectorInterface[]
* @readonly
*/
private $rectors;

View File

@ -13,12 +13,12 @@ use RectorPrefix20211230\Webmozart\Assert\Assert;
final class ProcessResult
{
/**
* @var \Rector\Core\ValueObject\Error\SystemError[]
* @var SystemError[]
* @readonly
*/
private $systemErrors;
/**
* @var \Rector\Core\ValueObject\Reporting\FileDiff[]
* @var FileDiff[]
* @readonly
*/
private $fileDiffs;

View File

@ -51,7 +51,7 @@ final class FileDiff implements \RectorPrefix20211230\Symplify\EasyParallel\Cont
*/
private $diffConsoleFormatted;
/**
* @var \Rector\ChangesReporting\ValueObject\RectorWithLineChange[]
* @var RectorWithLineChange[]
* @readonly
*/
private $rectorsWithLineChanges = [];

View File

@ -13,7 +13,7 @@ final class SprintfStringAndArgs
*/
private $string;
/**
* @var \PhpParser\Node\Expr[]
* @var Expr[]
* @readonly
*/
private $arrayItems;

View File

@ -25,7 +25,7 @@ final class FileFactory
*/
private $changedFilesDetector;
/**
* @var \Rector\Core\Contract\Processor\FileProcessorInterface[]
* @var FileProcessorInterface[]
* @readonly
*/
private $fileProcessors;

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8::getLoader();
return ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d::getLoader();

View File

@ -2027,6 +2027,7 @@ return array(
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradePropertyPromotionRector' => $baseDir . '/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php',
'Rector\\DowngradePhp80\\Rector\\Expression\\DowngradeMatchToSwitchRector' => $baseDir . '/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php',
'Rector\\DowngradePhp80\\Rector\\Expression\\DowngradeThrowExprRector' => $baseDir . '/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeArrayFilterNullableCallbackRector' => $baseDir . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrContainsRector' => $baseDir . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrContainsRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrEndsWithRector' => $baseDir . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrStartsWithRector' => $baseDir . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php',
@ -2742,6 +2743,7 @@ return array(
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => $baseDir . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
'Rector\\Privatization\\Reflection\\ClassConstantsResolver' => $baseDir . '/rules/Privatization/Reflection/ClassConstantsResolver.php',
'Rector\\Privatization\\TypeManipulator\\NormalizeTypeToRespectArrayScalarType' => $baseDir . '/rules/Privatization/TypeManipulator/NormalizeTypeToRespectArrayScalarType.php',
'Rector\\Privatization\\TypeManipulator\\TypeNormalizer' => $baseDir . '/rules/Privatization/TypeManipulator/TypeNormalizer.php',
'Rector\\Privatization\\ValueObject\\ReplaceStringWithClassConstant' => $baseDir . '/rules/Privatization/ValueObject/ReplaceStringWithClassConstant.php',
'Rector\\Privatization\\VisibilityGuard\\ClassMethodVisibilityGuard' => $baseDir . '/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php',
'Rector\\ReadWrite\\Contract\\ReadNodeAnalyzerInterface' => $baseDir . '/packages/ReadWrite/Contract/ReadNodeAnalyzerInterface.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8
class ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirecaaf83b3505f8f508ceafb2a7acb81e8($fileIdentifier, $file);
composerRequire8dcd277f4f9bfb02febf0cacdd15558d($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8
* @param string $file
* @return void
*/
function composerRequirecaaf83b3505f8f508ceafb2a7acb81e8($fileIdentifier, $file)
function composerRequire8dcd277f4f9bfb02febf0cacdd15558d($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 ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8
class ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -2422,6 +2422,7 @@ class ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradePropertyPromotionRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php',
'Rector\\DowngradePhp80\\Rector\\Expression\\DowngradeMatchToSwitchRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php',
'Rector\\DowngradePhp80\\Rector\\Expression\\DowngradeThrowExprRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeArrayFilterNullableCallbackRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrContainsRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrContainsRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrEndsWithRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php',
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrStartsWithRector' => __DIR__ . '/../..' . '/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php',
@ -3137,6 +3138,7 @@ class ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
'Rector\\Privatization\\Reflection\\ClassConstantsResolver' => __DIR__ . '/../..' . '/rules/Privatization/Reflection/ClassConstantsResolver.php',
'Rector\\Privatization\\TypeManipulator\\NormalizeTypeToRespectArrayScalarType' => __DIR__ . '/../..' . '/rules/Privatization/TypeManipulator/NormalizeTypeToRespectArrayScalarType.php',
'Rector\\Privatization\\TypeManipulator\\TypeNormalizer' => __DIR__ . '/../..' . '/rules/Privatization/TypeManipulator/TypeNormalizer.php',
'Rector\\Privatization\\ValueObject\\ReplaceStringWithClassConstant' => __DIR__ . '/../..' . '/rules/Privatization/ValueObject/ReplaceStringWithClassConstant.php',
'Rector\\Privatization\\VisibilityGuard\\ClassMethodVisibilityGuard' => __DIR__ . '/../..' . '/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php',
'Rector\\ReadWrite\\Contract\\ReadNodeAnalyzerInterface' => __DIR__ . '/../..' . '/packages/ReadWrite/Contract/ReadNodeAnalyzerInterface.php',
@ -3842,9 +3844,9 @@ class ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcaaf83b3505f8f508ceafb2a7acb81e8::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8dcd277f4f9bfb02febf0cacdd15558d::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2310,12 +2310,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-laravel.git",
"reference": "7bcfd90d9dbcfcf1cb33ebbe06adee91a94b08bb"
"reference": "96d50d4383d37615cf69d2415cc469f36c8b552f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/7bcfd90d9dbcfcf1cb33ebbe06adee91a94b08bb",
"reference": "7bcfd90d9dbcfcf1cb33ebbe06adee91a94b08bb",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/96d50d4383d37615cf69d2415cc469f36c8b552f",
"reference": "96d50d4383d37615cf69d2415cc469f36c8b552f",
"shasum": ""
},
"require": {
@ -2339,7 +2339,7 @@
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2021-12-24T20:37:06+00:00",
"time": "2021-12-30T11:30:47+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f601f07'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d65a9b0'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 36d651e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7bcfd90'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bb2575d'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3f56f3b'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 1e9f0c3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b92de39'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5349e2b'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f601f07'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d65a9b0'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 36d651e'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 96d50d4'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bb2575d'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3f56f3b'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 1e9f0c3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b92de39'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5349e2b'));
private function __construct()
{
}

View File

@ -8,11 +8,11 @@ use PhpParser\Node\Expr\ArrayItem;
final class ArrayItemsAndFluentClass
{
/**
* @var \PhpParser\Node\Expr\ArrayItem[]
* @var ArrayItem[]
*/
private $arrayItems;
/**
* @var array<string, \PhpParser\Node\Expr>
* @var array<string, Expr>
*/
private $fluentCalls;
/**

View File

@ -32,7 +32,7 @@ final class ColumnPropertyTypeResolver
*/
private $typeFactory;
/**
* @var array<string, \PHPStan\Type\Type>
* @var array<string, Type>
*/
private $doctrineTypeToScalarType;
/**

View File

@ -7,7 +7,7 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
final class PropertyNamesAndPhpDocInfos
{
/**
* @var \Rector\Doctrine\ValueObject\PropertyNameAndPhpDocInfo[]
* @var PropertyNameAndPhpDocInfo[]
*/
private $propertyNameAndPhpDocInfos;
/**

View File

@ -21,7 +21,7 @@ use Rector\Laravel\Set\LaravelSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(LaravelSetList::LARAVEL_60);
$containerConfigurator->import(LaravelSetList::LARAVEL_80);
};
```

View File

@ -18,6 +18,9 @@ final class AddArgumentDefaultValue
* @var int
*/
private $position;
/**
* @var mixed
*/
private $defaultValue;
/**
* @param mixed $defaultValue

View File

@ -28,7 +28,7 @@ final class Service_ extends \Rector\Nette\NeonParser\Node\AbstractVirtualNode
*/
private $factoryLiteralNode;
/**
* @var \Rector\Nette\NeonParser\Node\Service_\SetupMethodCall[]
* @var SetupMethodCall[]
*/
private $setupMethodCalls;
/**

View File

@ -14,7 +14,7 @@ use Rector\Parallel\ValueObject\Bridge;
final class LatteFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var \Rector\Nette\Contract\Rector\LatteRectorInterface[]
* @var LatteRectorInterface[]
*/
private $latteRectors;
/**

View File

@ -29,7 +29,7 @@ final class NeonFileProcessor implements \Rector\Core\Contract\Processor\FilePro
*/
private $formatPreservingNeonPrinter;
/**
* @var \Rector\Nette\Contract\Rector\NeonRectorInterface[]
* @var NeonRectorInterface[]
*/
private $neonRectors;
/**

View File

@ -8,7 +8,7 @@ use Rector\Nette\Contract\FormControlTypeResolverInterface;
final class MethodNamesByInputNamesResolver
{
/**
* @var \Rector\Nette\Contract\FormControlTypeResolverInterface[]
* @var FormControlTypeResolverInterface[]
*/
private $formControlTypeResolvers;
/**

View File

@ -7,15 +7,15 @@ use PhpParser\Node\Expr;
final class TemplateParametersAssigns
{
/**
* @var \Rector\Nette\ValueObject\AlwaysTemplateParameterAssign[]
* @var AlwaysTemplateParameterAssign[]
*/
private $templateParameterAssigns;
/**
* @var \Rector\Nette\ValueObject\ParameterAssign[]
* @var ParameterAssign[]
*/
private $conditionalTemplateParameterAssign;
/**
* @var \Rector\Nette\ValueObject\AlwaysTemplateParameterAssign[]
* @var AlwaysTemplateParameterAssign[]
*/
private $defaultChangeableTemplateParameterAssigns;
/**

View File

@ -11,7 +11,7 @@ final class DataProviderClassMethodRecipe
*/
private $methodName;
/**
* @var \PhpParser\Node\Arg[]
* @var Arg[]
*/
private $args;
/**

View File

@ -11,11 +11,11 @@ use PhpParser\Node\Stmt\Expression;
final class ExpectationMock
{
/**
* @var PropertyFetch|Variable
* @var Variable|PropertyFetch
*/
private $expectationVariable;
/**
* @var \PhpParser\Node\Arg[]
* @var Arg[]
*/
private $methodArguments;
/**
@ -27,7 +27,7 @@ final class ExpectationMock
*/
private $expr;
/**
* @var \PhpParser\Node\Expr[]|null[]
* @var array<int, (null | Expr)>
*/
private $withArguments;
/**

View File

@ -27,7 +27,7 @@ final class ServiceDefinition
*/
private $alias;
/**
* @var \Rector\Symfony\Contract\Tag\TagInterface[]
* @var TagInterface[]
*/
private $tags;
/**

View File

@ -9,7 +9,7 @@ use Rector\Symfony\ValueObject\ServiceDefinition;
final class ServiceMap
{
/**
* @var \Rector\Symfony\ValueObject\ServiceDefinition[]
* @var ServiceDefinition[]
*/
private $services;
/**

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211230\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8', false) && !interface_exists('ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8', false) && !trait_exists('ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8', false)) {
spl_autoload_call('RectorPrefix20211230\ComposerAutoloaderInitcaaf83b3505f8f508ceafb2a7acb81e8');
if (!class_exists('ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d', false) && !interface_exists('ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d', false) && !trait_exists('ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d', false)) {
spl_autoload_call('RectorPrefix20211230\ComposerAutoloaderInit8dcd277f4f9bfb02febf0cacdd15558d');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20211230\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -78,9 +78,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211230\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirecaaf83b3505f8f508ceafb2a7acb81e8')) {
function composerRequirecaaf83b3505f8f508ceafb2a7acb81e8() {
return \RectorPrefix20211230\composerRequirecaaf83b3505f8f508ceafb2a7acb81e8(...func_get_args());
if (!function_exists('composerRequire8dcd277f4f9bfb02febf0cacdd15558d')) {
function composerRequire8dcd277f4f9bfb02febf0cacdd15558d() {
return \RectorPrefix20211230\composerRequire8dcd277f4f9bfb02febf0cacdd15558d(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -20,7 +20,7 @@ use UnexpectedValueException;
final class FlexFormsProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\FlexForms\Rector\FlexFormRectorInterface[]
* @var FlexFormRectorInterface[]
*/
private $flexFormRectors;
/**

View File

@ -17,7 +17,7 @@ use Ssch\TYPO3Rector\Contract\FileProcessor\Fluid\Rector\FluidRectorInterface;
final class FluidFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\Fluid\Rector\FluidRectorInterface[]
* @var FluidRectorInterface[]
*/
private $fluidRectors;
/**

View File

@ -33,7 +33,7 @@ final class IconsFileProcessor implements \Rector\Core\Contract\Processor\FilePr
*/
private $smartFileSystem;
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\Resources\IconRectorInterface[]
* @var IconRectorInterface[]
*/
private $iconsRector;
/**

View File

@ -23,7 +23,7 @@ final class OldConditionToExpressionLanguageTypoScriptRector extends \Ssch\TYPO3
*/
private $currentFileProvider;
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\TypoScript\Conditions\TyposcriptConditionMatcher[]
* @var TyposcriptConditionMatcher[]
*/
private $conditionMatchers = [];
/**

View File

@ -70,7 +70,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
*/
private $rectorOutputStyle;
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\TypoScript\TypoScriptRectorInterface[]
* @var TypoScriptRectorInterface[]
*/
private $typoScriptRectors = [];
/**

View File

@ -36,7 +36,7 @@ final class FormYamlFileProcessor implements \Rector\Core\Contract\Processor\Fil
*/
private $yamlIndentResolver;
/**
* @var \Ssch\TYPO3Rector\Contract\FileProcessor\Yaml\Form\FormYamlRectorInterface[]
* @var FormYamlRectorInterface[]
*/
private $transformer;
/**

View File

@ -22,7 +22,7 @@ final class DatabaseConnectionToDbalRector extends \Rector\Core\Rector\AbstractR
*/
private $typo3NodeResolver;
/**
* @var \Ssch\TYPO3Rector\Contract\Helper\Database\Refactorings\DatabaseConnectionToDbalRefactoring[]
* @var DatabaseConnectionToDbalRefactoring[]
*/
private $databaseConnectionRefactorings;
/**

View File

@ -23,7 +23,7 @@ final class SimpleNameResolver
*/
private const ANONYMOUS_CLASS_REGEX = '#^AnonymousClass[\\w+]#';
/**
* @var \Symplify\Astral\Contract\NodeNameResolverInterface[]
* @var NodeNameResolverInterface[]
*/
private $nodeNameResolvers;
/**

View File

@ -14,7 +14,7 @@ final class Schedule
*/
private $numberOfProcesses;
/**
* @var string[][]
* @var array<array<string>>
*/
private $jobs;
/**

View File

@ -9,6 +9,9 @@ final class InputAndExpected
* @var string
*/
private $input;
/**
* @var mixed
*/
private $expected;
/**
* @param mixed $expected

View File

@ -10,6 +10,9 @@ final class InputFileInfoAndExpected
* @var \Symplify\SmartFileSystem\SmartFileInfo
*/
private $inputFileInfo;
/**
* @var mixed
*/
private $expected;
/**
* @param mixed $expected

View File

@ -16,7 +16,7 @@ final class Skipper
*/
private const FILE_ELEMENT = 'file_elements';
/**
* @var \Symplify\Skipper\Contract\SkipVoterInterface[]
* @var SkipVoterInterface[]
*/
private $skipVoters;
/**

View File

@ -17,7 +17,7 @@ use Throwable;
final class KernelBootAndApplicationRun
{
/**
* @var class-string<\Symfony\Component\HttpKernel\KernelInterface|\Symplify\SymplifyKernel\Contract\LightKernelInterface>
* @var class-string<(KernelInterface | LightKernelInterface)>
*/
private $kernelClass;
/**