mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit ae874efa148e6d5a031503892a6307824b4d7003
ae874efa14
Remove SourceLocatorProviderInterface as unused (#4126)
This commit is contained in:
parent
8b89240eee
commit
f82e30a026
@ -8,7 +8,6 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use Stringable;
|
||||
final class ArrayItemNode implements PhpDocTagValueNode
|
||||
{
|
||||
use NodeAttributes;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
@ -17,6 +16,7 @@ final class ArrayItemNode implements PhpDocTagValueNode
|
||||
* @var mixed
|
||||
*/
|
||||
public $key = null;
|
||||
use NodeAttributes;
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param mixed $key
|
||||
|
@ -10,11 +10,11 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Stringable;
|
||||
final class StringNode implements PhpDocTagValueNode
|
||||
{
|
||||
use NodeAttributes;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
use NodeAttributes;
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
@ -39,23 +39,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
*/
|
||||
final class PhpDocInfo
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<PhpDocTagValueNode>, string>
|
||||
*/
|
||||
private const TAGS_TYPES_TO_NAMES = [ReturnTagValueNode::class => '@return', ParamTagValueNode::class => '@param', VarTagValueNode::class => '@var', MethodTagValueNode::class => '@method', PropertyTagValueNode::class => '@property'];
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isSingleLine = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
*/
|
||||
private $originalPhpDocNode;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
@ -96,6 +79,23 @@ final class PhpDocInfo
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder
|
||||
*/
|
||||
private $phpDocNodeByTypeFinder;
|
||||
/**
|
||||
* @var array<class-string<PhpDocTagValueNode>, string>
|
||||
*/
|
||||
private const TAGS_TYPES_TO_NAMES = [ReturnTagValueNode::class => '@return', ParamTagValueNode::class => '@param', VarTagValueNode::class => '@var', MethodTagValueNode::class => '@method', PropertyTagValueNode::class => '@property'];
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isSingleLine = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode
|
||||
*/
|
||||
private $originalPhpDocNode;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
public function __construct(PhpDocNode $phpDocNode, BetterTokenIterator $betterTokenIterator, StaticTypeMapper $staticTypeMapper, \PhpParser\Node $node, AnnotationNaming $annotationNaming, CurrentNodeProvider $currentNodeProvider, RectorChangeCollector $rectorChangeCollector, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
{
|
||||
$this->phpDocNode = $phpDocNode;
|
||||
|
@ -21,10 +21,6 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
final class PhpDocInfoFactory
|
||||
{
|
||||
/**
|
||||
* @var array<string, PhpDocInfo>
|
||||
*/
|
||||
private $phpDocInfosByObjectHash = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocNodeMapper
|
||||
@ -65,6 +61,10 @@ final class PhpDocInfoFactory
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder
|
||||
*/
|
||||
private $phpDocNodeByTypeFinder;
|
||||
/**
|
||||
* @var array<string, PhpDocInfo>
|
||||
*/
|
||||
private $phpDocInfosByObjectHash = [];
|
||||
public function __construct(PhpDocNodeMapper $phpDocNodeMapper, CurrentNodeProvider $currentNodeProvider, Lexer $lexer, BetterPhpDocParser $betterPhpDocParser, StaticTypeMapper $staticTypeMapper, AnnotationNaming $annotationNaming, RectorChangeCollector $rectorChangeCollector, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder)
|
||||
{
|
||||
$this->phpDocNodeMapper = $phpDocNodeMapper;
|
||||
|
@ -9,10 +9,6 @@ use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
final class TokenIteratorFactory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const INDEX = 'index';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\PhpDocParser\Lexer\Lexer
|
||||
@ -23,6 +19,10 @@ final class TokenIteratorFactory
|
||||
* @var \Rector\Core\Util\Reflection\PrivatesAccessor
|
||||
*/
|
||||
private $privatesAccessor;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const INDEX = 'index';
|
||||
public function __construct(Lexer $lexer, PrivatesAccessor $privatesAccessor)
|
||||
{
|
||||
$this->lexer = $lexer;
|
||||
|
@ -36,14 +36,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory;
|
||||
final class PhpDocTypeChanger
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const ALLOWED_TYPES = [GenericTypeNode::class, SpacingAwareArrayTypeNode::class, SpacingAwareCallableTypeNode::class, ArrayShapeNode::class];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_IDENTIFIER_TYPENODE_TYPES = ['class-string'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
@ -79,6 +71,14 @@ final class PhpDocTypeChanger
|
||||
* @var \Rector\BetterPhpDocParser\Guard\NewPhpDocFromPHPStanTypeGuard
|
||||
*/
|
||||
private $newPhpDocFromPHPStanTypeGuard;
|
||||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const ALLOWED_TYPES = [GenericTypeNode::class, SpacingAwareArrayTypeNode::class, SpacingAwareCallableTypeNode::class, ArrayShapeNode::class];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_IDENTIFIER_TYPENODE_TYPES = ['class-string'];
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, TypeComparator $typeComparator, ParamPhpDocNodeFactory $paramPhpDocNodeFactory, NodeNameResolver $nodeNameResolver, CommentsMerger $commentsMerger, PhpDocInfoFactory $phpDocInfoFactory, NewPhpDocFromPHPStanTypeGuard $newPhpDocFromPHPStanTypeGuard)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
|
@ -18,10 +18,6 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
*/
|
||||
final class ClassAnnotationMatcher
|
||||
{
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $fullyQualifiedNameByHash = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher
|
||||
@ -37,6 +33,10 @@ final class ClassAnnotationMatcher
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $fullyQualifiedNameByHash = [];
|
||||
public function __construct(UseImportNameMatcher $useImportNameMatcher, UseImportsResolver $useImportsResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->useImportNameMatcher = $useImportNameMatcher;
|
||||
|
@ -23,21 +23,6 @@ use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
use Rector\Core\Util\StringUtils;
|
||||
final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
||||
{
|
||||
/**
|
||||
* Special short annotations, that are resolved as FQN by Doctrine annotation parser
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_SHORT_ANNOTATIONS = ['Target'];
|
||||
/**
|
||||
* @see https://regex101.com/r/95kIw4/1
|
||||
* @var string
|
||||
*/
|
||||
private const LONG_ANNOTATION_REGEX = '#@\\\\(?<class_name>.*?)(?<annotation_content>\\(.*?\\))#';
|
||||
/**
|
||||
* @see https://regex101.com/r/xWaLOz/1
|
||||
* @var string
|
||||
*/
|
||||
private const NESTED_ANNOTATION_END_REGEX = '#(\\s+)?\\}\\)(\\s+)?#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher
|
||||
@ -58,6 +43,21 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
||||
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
||||
*/
|
||||
private $attributeMirrorer;
|
||||
/**
|
||||
* Special short annotations, that are resolved as FQN by Doctrine annotation parser
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_SHORT_ANNOTATIONS = ['Target'];
|
||||
/**
|
||||
* @see https://regex101.com/r/95kIw4/1
|
||||
* @var string
|
||||
*/
|
||||
private const LONG_ANNOTATION_REGEX = '#@\\\\(?<class_name>.*?)(?<annotation_content>\\(.*?\\))#';
|
||||
/**
|
||||
* @see https://regex101.com/r/xWaLOz/1
|
||||
* @var string
|
||||
*/
|
||||
private const NESTED_ANNOTATION_END_REGEX = '#(\\s+)?\\}\\)(\\s+)?#';
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer)
|
||||
{
|
||||
$this->classAnnotationMatcher = $classAnnotationMatcher;
|
||||
|
@ -21,14 +21,6 @@ use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
final class PlainValueParser
|
||||
{
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser
|
||||
*/
|
||||
private $staticDoctrineAnnotationParser;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser
|
||||
*/
|
||||
private $arrayParser;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher
|
||||
@ -39,6 +31,14 @@ final class PlainValueParser
|
||||
* @var \Rector\Core\Configuration\CurrentNodeProvider
|
||||
*/
|
||||
private $currentNodeProvider;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser
|
||||
*/
|
||||
private $staticDoctrineAnnotationParser;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser
|
||||
*/
|
||||
private $arrayParser;
|
||||
public function __construct(ClassAnnotationMatcher $classAnnotationMatcher, CurrentNodeProvider $currentNodeProvider)
|
||||
{
|
||||
$this->classAnnotationMatcher = $classAnnotationMatcher;
|
||||
|
@ -26,6 +26,26 @@ use Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser;
|
||||
*/
|
||||
final class PhpDocInfoPrinter
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector
|
||||
*/
|
||||
private $emptyPhpDocDetector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\DocBlockInliner
|
||||
*/
|
||||
private $docBlockInliner;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver
|
||||
*/
|
||||
private $removeNodesStartAndEndResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor
|
||||
*/
|
||||
private $changedPhpDocNodeVisitor;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/Ab0Vey/1
|
||||
@ -71,26 +91,6 @@ final class PhpDocInfoPrinter
|
||||
* @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser
|
||||
*/
|
||||
private $changedPhpDocNodeTraverser;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector
|
||||
*/
|
||||
private $emptyPhpDocDetector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\DocBlockInliner
|
||||
*/
|
||||
private $docBlockInliner;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver
|
||||
*/
|
||||
private $removeNodesStartAndEndResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor
|
||||
*/
|
||||
private $changedPhpDocNodeVisitor;
|
||||
public function __construct(\Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector $emptyPhpDocDetector, \Rector\BetterPhpDocParser\Printer\DocBlockInliner $docBlockInliner, \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver $removeNodesStartAndEndResolver, ChangedPhpDocNodeVisitor $changedPhpDocNodeVisitor)
|
||||
{
|
||||
$this->emptyPhpDocDetector = $emptyPhpDocDetector;
|
||||
|
@ -10,11 +10,6 @@ use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
abstract class AbstractValuesAwareNode implements PhpDocTagValueNode
|
||||
{
|
||||
use NodeAttributes;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $hasChanged = \false;
|
||||
/**
|
||||
* @var ArrayItemNode[]
|
||||
*/
|
||||
@ -27,6 +22,11 @@ abstract class AbstractValuesAwareNode implements PhpDocTagValueNode
|
||||
* @var string|null
|
||||
*/
|
||||
protected $silentKey;
|
||||
use NodeAttributes;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $hasChanged = \false;
|
||||
/**
|
||||
* @param ArrayItemNode[] $values Must be public so node traverser can go through them
|
||||
*/
|
||||
|
@ -14,14 +14,6 @@ use Rector\Core\Util\FileHasher;
|
||||
*/
|
||||
final class ChangedFilesDetector
|
||||
{
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $dependentFiles = [];
|
||||
/**
|
||||
* @var array<string, true>
|
||||
*/
|
||||
private $cachableFiles = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Caching\Config\FileHashComputer
|
||||
@ -37,6 +29,14 @@ final class ChangedFilesDetector
|
||||
* @var \Rector\Core\Util\FileHasher
|
||||
*/
|
||||
private $fileHasher;
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $dependentFiles = [];
|
||||
/**
|
||||
* @var array<string, true>
|
||||
*/
|
||||
private $cachableFiles = [];
|
||||
public function __construct(FileHashComputer $fileHashComputer, Cache $cache, FileHasher $fileHasher)
|
||||
{
|
||||
$this->fileHashComputer = $fileHashComputer;
|
||||
|
@ -13,15 +13,6 @@ use Rector\Core\ValueObject\ProcessResult;
|
||||
use Rector\Core\ValueObject\Reporting\FileDiff;
|
||||
final class ConsoleOutputFormatter implements OutputFormatterInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NAME = 'console';
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/q8I66g/1
|
||||
*/
|
||||
private const ON_LINE_REGEX = '# on line #';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
@ -32,6 +23,15 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
||||
* @var \Rector\ChangesReporting\Annotation\RectorsChangelogResolver
|
||||
*/
|
||||
private $rectorsChangelogResolver;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NAME = 'console';
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/q8I66g/1
|
||||
*/
|
||||
private const ON_LINE_REGEX = '# on line #';
|
||||
public function __construct(OutputStyleInterface $rectorOutputStyle, RectorsChangelogResolver $rectorsChangelogResolver)
|
||||
{
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
|
@ -12,15 +12,15 @@ use Rector\Core\ValueObject\ProcessResult;
|
||||
use Rector\Parallel\ValueObject\Bridge;
|
||||
final class JsonOutputFormatter implements OutputFormatterInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NAME = 'json';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\ChangesReporting\Annotation\RectorsChangelogResolver
|
||||
*/
|
||||
private $rectorsChangelogResolver;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NAME = 'json';
|
||||
public function __construct(RectorsChangelogResolver $rectorsChangelogResolver)
|
||||
{
|
||||
$this->rectorsChangelogResolver = $rectorsChangelogResolver;
|
||||
|
@ -8,6 +8,11 @@ use RectorPrefix202306\Symplify\EasyParallel\Contract\SerializableInterface;
|
||||
use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
final class RectorWithLineChange implements SerializableInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
*/
|
||||
private $line;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -21,11 +26,6 @@ final class RectorWithLineChange implements SerializableInterface
|
||||
* @readonly
|
||||
*/
|
||||
private $rectorClass;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
*/
|
||||
private $line;
|
||||
/**
|
||||
* @param string|\Rector\Core\Contract\Rector\RectorInterface $rectorClass
|
||||
*/
|
||||
|
@ -20,17 +20,6 @@ use Rector\NodeNameResolver\Regex\RegexPatternDetector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class NodeNameResolver
|
||||
{
|
||||
/**
|
||||
* Used to check if a string might contain a regex or fnmatch pattern
|
||||
*
|
||||
* @var string
|
||||
* @see https://regex101.com/r/ImTV1W/1
|
||||
*/
|
||||
private const CONTAINS_WILDCARD_CHARS_REGEX = '/[\\*\\#\\~\\/]/';
|
||||
/**
|
||||
* @var array<string, NodeNameResolverInterface|null>
|
||||
*/
|
||||
private $nodeNameResolversByClass = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\Regex\RegexPatternDetector
|
||||
@ -51,6 +40,17 @@ final class NodeNameResolver
|
||||
* @readonly
|
||||
*/
|
||||
private $nodeNameResolvers = [];
|
||||
/**
|
||||
* Used to check if a string might contain a regex or fnmatch pattern
|
||||
*
|
||||
* @var string
|
||||
* @see https://regex101.com/r/ImTV1W/1
|
||||
*/
|
||||
private const CONTAINS_WILDCARD_CHARS_REGEX = '/[\\*\\#\\~\\/]/';
|
||||
/**
|
||||
* @var array<string, NodeNameResolverInterface|null>
|
||||
*/
|
||||
private $nodeNameResolversByClass = [];
|
||||
/**
|
||||
* @param NodeNameResolverInterface[] $nodeNameResolvers
|
||||
*/
|
||||
|
@ -12,16 +12,16 @@ use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNestingScope\ValueObject\ControlStructure;
|
||||
final class ContextAnalyzer
|
||||
{
|
||||
/**
|
||||
* Nodes that break the scope they way up, e.g. class method
|
||||
* @var array<class-string<FunctionLike>>
|
||||
*/
|
||||
private const BREAK_NODES = [FunctionLike::class, ClassMethod::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* Nodes that break the scope they way up, e.g. class method
|
||||
* @var array<class-string<FunctionLike>>
|
||||
*/
|
||||
private const BREAK_NODES = [FunctionLike::class, ClassMethod::class];
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -13,10 +13,6 @@ use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNestingScope\ValueObject\ControlStructure;
|
||||
final class ScopeNestingComparator
|
||||
{
|
||||
/**
|
||||
* @var Expr[]
|
||||
*/
|
||||
private $doubleIfBranchExprs = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
@ -27,6 +23,10 @@ final class ScopeNestingComparator
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
/**
|
||||
* @var Expr[]
|
||||
*/
|
||||
private $doubleIfBranchExprs = [];
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NodeTypeResolver\Contract;
|
||||
|
||||
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
interface SourceLocatorProviderInterface
|
||||
{
|
||||
public function provide() : SourceLocator;
|
||||
}
|
@ -24,11 +24,6 @@ use RectorPrefix202306\Symfony\Component\Filesystem\Filesystem;
|
||||
*/
|
||||
final class PHPStanServicesFactory
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\DependencyInjection\Container
|
||||
*/
|
||||
private $container;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Configuration\Parameter\ParameterProvider
|
||||
@ -39,6 +34,11 @@ final class PHPStanServicesFactory
|
||||
* @var \Rector\NodeTypeResolver\DependencyInjection\PHPStanExtensionsConfigResolver
|
||||
*/
|
||||
private $phpStanExtensionsConfigResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\DependencyInjection\Container
|
||||
*/
|
||||
private $container;
|
||||
public function __construct(ParameterProvider $parameterProvider, \Rector\NodeTypeResolver\DependencyInjection\PHPStanExtensionsConfigResolver $phpStanExtensionsConfigResolver, \Rector\NodeTypeResolver\DependencyInjection\BleedingEdgeIncludePurifier $bleedingEdgeIncludePurifier)
|
||||
{
|
||||
$this->parameterProvider = $parameterProvider;
|
||||
|
@ -12,16 +12,16 @@ use Rector\NodeTypeResolver\NodeVisitor\FunctionLikeParamArgPositionNodeVisitor;
|
||||
use Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver;
|
||||
final class NodeScopeAndMetadataDecorator
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\NodeTraverser
|
||||
*/
|
||||
private $nodeTraverser;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver
|
||||
*/
|
||||
private $phpStanNodeScopeResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\NodeTraverser
|
||||
*/
|
||||
private $nodeTraverser;
|
||||
public function __construct(CloningVisitor $cloningVisitor, PHPStanNodeScopeResolver $phpStanNodeScopeResolver, ParentConnectingVisitor $parentConnectingVisitor, FunctionLikeParamArgPositionNodeVisitor $functionLikeParamArgPositionNodeVisitor)
|
||||
{
|
||||
$this->phpStanNodeScopeResolver = $phpStanNodeScopeResolver;
|
||||
|
@ -42,10 +42,6 @@ use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
|
||||
use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier;
|
||||
final class NodeTypeResolver
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Node>, NodeTypeResolverInterface>
|
||||
*/
|
||||
private $nodeTypeResolvers = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier
|
||||
@ -76,6 +72,10 @@ final class NodeTypeResolver
|
||||
* @var \Rector\Core\Configuration\RenamedClassesDataCollector
|
||||
*/
|
||||
private $renamedClassesDataCollector;
|
||||
/**
|
||||
* @var array<class-string<Node>, NodeTypeResolverInterface>
|
||||
*/
|
||||
private $nodeTypeResolvers = [];
|
||||
/**
|
||||
* @param NodeTypeResolverInterface[] $nodeTypeResolvers
|
||||
*/
|
||||
|
@ -18,15 +18,15 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class ClassMethodOrClassConstTypeResolver implements NodeTypeResolverInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -30,14 +30,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class ParamTypeResolver implements NodeTypeResolverInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
private $staticTypeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser
|
||||
@ -58,6 +50,14 @@ final class ParamTypeResolver implements NodeTypeResolverInterface
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
private $staticTypeMapper;
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, PhpDocInfoFactory $phpDocInfoFactory, BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
|
@ -24,10 +24,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class PropertyFetchTypeResolver implements NodeTypeResolverInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -43,6 +39,10 @@ final class PropertyFetchTypeResolver implements NodeTypeResolverInterface
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -22,10 +22,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -36,6 +32,10 @@ final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterfac
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -18,6 +18,11 @@ use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNode
|
||||
*/
|
||||
final class RemoveDeepChainMethodCallNodeVisitor extends NodeVisitorAbstract implements ScopeResolverNodeVisitorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
@ -27,11 +32,6 @@ final class RemoveDeepChainMethodCallNodeVisitor extends NodeVisitorAbstract imp
|
||||
* @var \PhpParser\Node\Stmt\Expression|null
|
||||
*/
|
||||
private $removingExpression;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, ParameterProvider $parameterProvider)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -60,15 +60,6 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class PHPStanNodeScopeResolver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CONTEXT = 'context';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\NodeTraverser
|
||||
*/
|
||||
private $nodeTraverser;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Caching\Detector\ChangedFilesDetector
|
||||
@ -114,6 +105,15 @@ final class PHPStanNodeScopeResolver
|
||||
* @var \Rector\Core\PhpParser\NodeTraverser\FileWithoutNamespaceNodeTraverser
|
||||
*/
|
||||
private $fileWithoutNamespaceNodeTraverser;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CONTEXT = 'context';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\NodeTraverser
|
||||
*/
|
||||
private $nodeTraverser;
|
||||
/**
|
||||
* @param ScopeResolverNodeVisitorInterface[] $nodeVisitors
|
||||
*/
|
||||
|
@ -28,10 +28,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
|
||||
final class ClassRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
{
|
||||
/**
|
||||
* @var OldToNewType[]
|
||||
*/
|
||||
private $oldToNewTypes = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
@ -62,6 +58,10 @@ final class ClassRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
* @var \Rector\Core\Configuration\RectorConfigProvider
|
||||
*/
|
||||
private $rectorConfigProvider;
|
||||
/**
|
||||
* @var OldToNewType[]
|
||||
*/
|
||||
private $oldToNewTypes = [];
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, CurrentNodeProvider $currentNodeProvider, UseImportsResolver $useImportsResolver, BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, RectorConfigProvider $rectorConfigProvider)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
|
@ -25,10 +25,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
final class NameImportingPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
{
|
||||
/**
|
||||
* @var PhpParserNode|null
|
||||
*/
|
||||
private $currentPhpParserNode;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
@ -59,6 +55,10 @@ final class NameImportingPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var PhpParserNode|null
|
||||
*/
|
||||
private $currentPhpParserNode;
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, ParameterProvider $parameterProvider, ClassNameImportSkipper $classNameImportSkipper, UseNodesToAddCollector $useNodesToAddCollector, CurrentFileProvider $currentFileProvider, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
|
@ -12,10 +12,6 @@ use Rector\Renaming\ValueObject\PseudoNamespaceToNamespace;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
final class UnderscoreRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
@ -31,6 +27,10 @@ final class UnderscoreRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor
|
||||
* @var \PhpParser\Node
|
||||
*/
|
||||
private $phpNode;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
public function __construct(StaticTypeMapper $staticTypeMapper, PseudoNamespaceToNamespace $pseudoNamespaceToNamespace, \PhpParser\Node $phpNode)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
|
@ -8,30 +8,25 @@ use PHPStan\BetterReflection\Identifier\IdentifierType;
|
||||
use PHPStan\BetterReflection\Reflection\Reflection;
|
||||
use PHPStan\BetterReflection\Reflector\Reflector;
|
||||
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
|
||||
use Rector\NodeTypeResolver\Contract\SourceLocatorProviderInterface;
|
||||
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
|
||||
final class IntermediateSourceLocator implements SourceLocator
|
||||
{
|
||||
/**
|
||||
* @var SourceLocatorProviderInterface[]
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider
|
||||
*/
|
||||
private $sourceLocatorProviders;
|
||||
/**
|
||||
* @param SourceLocatorProviderInterface[] $sourceLocatorProviders
|
||||
*/
|
||||
public function __construct(array $sourceLocatorProviders)
|
||||
private $dynamicSourceLocatorProvider;
|
||||
public function __construct(DynamicSourceLocatorProvider $dynamicSourceLocatorProvider)
|
||||
{
|
||||
$this->sourceLocatorProviders = $sourceLocatorProviders;
|
||||
$this->dynamicSourceLocatorProvider = $dynamicSourceLocatorProvider;
|
||||
}
|
||||
public function locateIdentifier(Reflector $reflector, Identifier $identifier) : ?Reflection
|
||||
{
|
||||
foreach ($this->sourceLocatorProviders as $sourceLocatorProvider) {
|
||||
$sourceLocator = $sourceLocatorProvider->provide();
|
||||
$sourceLocator = $this->dynamicSourceLocatorProvider->provide();
|
||||
$reflection = $sourceLocator->locateIdentifier($reflector, $identifier);
|
||||
if ($reflection instanceof Reflection) {
|
||||
return $reflection;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
@ -40,13 +35,11 @@ final class IntermediateSourceLocator implements SourceLocator
|
||||
*/
|
||||
public function locateIdentifiersByType(Reflector $reflector, IdentifierType $identifierType) : array
|
||||
{
|
||||
foreach ($this->sourceLocatorProviders as $sourceLocatorProvider) {
|
||||
$sourceLocator = $sourceLocatorProvider->provide();
|
||||
$sourceLocator = $this->dynamicSourceLocatorProvider->provide();
|
||||
$reflections = $sourceLocator->locateIdentifiersByType($reflector, $identifierType);
|
||||
if ($reflections !== []) {
|
||||
return $reflections;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,23 @@ use PHPStan\Php\PhpVersion;
|
||||
use PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher;
|
||||
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLocator;
|
||||
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocator;
|
||||
use Rector\NodeTypeResolver\Contract\SourceLocatorProviderInterface;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @api phpstan external
|
||||
*/
|
||||
final class DynamicSourceLocatorProvider implements SourceLocatorProviderInterface
|
||||
final class DynamicSourceLocatorProvider
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher
|
||||
*/
|
||||
private $fileNodesFetcher;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Php\PhpVersion
|
||||
*/
|
||||
private $phpVersion;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@ -29,16 +38,6 @@ final class DynamicSourceLocatorProvider implements SourceLocatorProviderInterfa
|
||||
* @var \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator|null
|
||||
*/
|
||||
private $aggregateSourceLocator;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher
|
||||
*/
|
||||
private $fileNodesFetcher;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Php\PhpVersion
|
||||
*/
|
||||
private $phpVersion;
|
||||
public function __construct(FileNodesFetcher $fileNodesFetcher, PhpVersion $phpVersion)
|
||||
{
|
||||
$this->fileNodesFetcher = $fileNodesFetcher;
|
||||
|
@ -8,10 +8,6 @@ use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
final class CountableTypeAnalyzer
|
||||
{
|
||||
/**
|
||||
* @var ObjectType[]
|
||||
*/
|
||||
private $countableObjectTypes = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer
|
||||
@ -22,6 +18,10 @@ final class CountableTypeAnalyzer
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var ObjectType[]
|
||||
*/
|
||||
private $countableObjectTypes = [];
|
||||
public function __construct(\Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer $arrayTypeAnalyzer, NodeTypeResolver $nodeTypeResolver)
|
||||
{
|
||||
$this->arrayTypeAnalyzer = $arrayTypeAnalyzer;
|
||||
|
@ -20,12 +20,6 @@ use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector;
|
||||
final class UnionTypeCommonTypeNarrower
|
||||
{
|
||||
/**
|
||||
* Key = the winner Array = the group of types matched
|
||||
*
|
||||
* @var array<string, array<class-string<Node>|class-string<\PHPStan\PhpDocParser\Ast\Node>|class-string<RectorInterface>>>
|
||||
*/
|
||||
private const PRIORITY_TYPES = [ClassLike::class => [ClassLike::class], FunctionLike::class => [FunctionLike::class], BinaryOp::class => [BinaryOp::class, Expr::class], Expr::class => [Node::class, Expr::class], Stmt::class => [Node::class, Stmt::class], PhpDocTagValueNode::class => [PhpDocTagValueNode::class, \PHPStan\PhpDocParser\Ast\Node::class], Node::class => [Node::class], RectorInterface::class => [RectorInterface::class]];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector
|
||||
@ -36,6 +30,12 @@ final class UnionTypeCommonTypeNarrower
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* Key = the winner Array = the group of types matched
|
||||
*
|
||||
* @var array<string, array<class-string<Node>|class-string<\PHPStan\PhpDocParser\Ast\Node>|class-string<RectorInterface>>>
|
||||
*/
|
||||
private const PRIORITY_TYPES = [ClassLike::class => [ClassLike::class], FunctionLike::class => [FunctionLike::class], BinaryOp::class => [BinaryOp::class, Expr::class], Expr::class => [Node::class, Expr::class], Stmt::class => [Node::class, Stmt::class], PhpDocTagValueNode::class => [PhpDocTagValueNode::class, \PHPStan\PhpDocParser\Ast\Node::class], Node::class => [Node::class], RectorInterface::class => [RectorInterface::class]];
|
||||
public function __construct(GenericClassStringTypeCorrector $genericClassStringTypeCorrector, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->genericClassStringTypeCorrector = $genericClassStringTypeCorrector;
|
||||
|
@ -22,15 +22,15 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class GenericClassStringTypeMapper implements TypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
|
@ -23,10 +23,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class IntersectionTypeMapper implements TypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
@ -37,6 +33,10 @@ final class IntersectionTypeMapper implements TypeMapperInterface
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
|
@ -46,10 +46,6 @@ use RectorPrefix202306\Webmozart\Assert\InvalidArgumentException;
|
||||
*/
|
||||
final class UnionTypeMapper implements TypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer
|
||||
@ -85,6 +81,10 @@ final class UnionTypeMapper implements TypeMapperInterface
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory
|
||||
*/
|
||||
private $typeFactory;
|
||||
/**
|
||||
* @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper
|
||||
*/
|
||||
private $phpStanStaticTypeMapper;
|
||||
public function __construct(DoctrineTypeAnalyzer $doctrineTypeAnalyzer, PhpVersionProvider $phpVersionProvider, UnionTypeAnalyzer $unionTypeAnalyzer, BoolUnionTypeAnalyzer $boolUnionTypeAnalyzer, UnionTypeCommonTypeNarrower $unionTypeCommonTypeNarrower, NodeNameResolver $nodeNameResolver, TypeFactory $typeFactory)
|
||||
{
|
||||
$this->doctrineTypeAnalyzer = $doctrineTypeAnalyzer;
|
||||
|
@ -18,15 +18,15 @@ use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
*/
|
||||
final class VoidTypeMapper implements TypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const VOID = 'void';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const VOID = 'void';
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
|
@ -35,14 +35,6 @@ use Throwable;
|
||||
*/
|
||||
final class ParallelFileProcessor
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const SYSTEM_ERROR_LIMIT = 50;
|
||||
/**
|
||||
* @var \Symplify\EasyParallel\ValueObject\ProcessPool|null
|
||||
*/
|
||||
private $processPool = null;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Parallel\Command\WorkerCommandLineFactory
|
||||
@ -53,6 +45,14 @@ final class ParallelFileProcessor
|
||||
* @var \Rector\Core\Configuration\Parameter\ParameterProvider
|
||||
*/
|
||||
private $parameterProvider;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const SYSTEM_ERROR_LIMIT = 50;
|
||||
/**
|
||||
* @var \Symplify\EasyParallel\ValueObject\ProcessPool|null
|
||||
*/
|
||||
private $processPool = null;
|
||||
public function __construct(WorkerCommandLineFactory $workerCommandLineFactory, ParameterProvider $parameterProvider)
|
||||
{
|
||||
$this->workerCommandLineFactory = $workerCommandLineFactory;
|
||||
|
@ -24,10 +24,6 @@ use RectorPrefix202306\Symplify\EasyParallel\Enum\ReactEvent;
|
||||
use Throwable;
|
||||
final class WorkerRunner
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const RESULT = 'result';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Util\ArrayParametersMerger
|
||||
@ -63,6 +59,10 @@ final class WorkerRunner
|
||||
* @readonly
|
||||
*/
|
||||
private $fileProcessors = [];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const RESULT = 'result';
|
||||
/**
|
||||
* @param FileProcessorInterface[] $fileProcessors
|
||||
*/
|
||||
|
@ -20,15 +20,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class ArrayAnnotationToAttributeMapper implements AnnotationToAttributeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\PhpAttribute\AnnotationToAttributeMapper
|
||||
*/
|
||||
private $annotationToAttributeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
/**
|
||||
* @var \Rector\PhpAttribute\AnnotationToAttributeMapper
|
||||
*/
|
||||
private $annotationToAttributeMapper;
|
||||
public function __construct(ValueResolver $valueResolver)
|
||||
{
|
||||
$this->valueResolver = $valueResolver;
|
||||
|
@ -19,10 +19,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class DoctrineAnnotationAnnotationToAttributeMapper implements AnnotationToAttributeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\PhpAttribute\AnnotationToAttributeMapper
|
||||
*/
|
||||
private $annotationToAttributeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
@ -33,6 +29,10 @@ final class DoctrineAnnotationAnnotationToAttributeMapper implements AnnotationT
|
||||
* @var \Rector\PhpAttribute\AttributeArrayNameInliner
|
||||
*/
|
||||
private $attributeArrayNameInliner;
|
||||
/**
|
||||
* @var \Rector\PhpAttribute\AnnotationToAttributeMapper
|
||||
*/
|
||||
private $annotationToAttributeMapper;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider, AttributeArrayNameInliner $attributeArrayNameInliner)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
|
@ -23,11 +23,6 @@ use Rector\PhpAttribute\AttributeArrayNameInliner;
|
||||
use Rector\PhpAttribute\NodeAnalyzer\ExprParameterReflectionTypeCorrector;
|
||||
final class PhpNestedAttributeGroupFactory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/g3d9jy/1
|
||||
*/
|
||||
private const SHORT_ORM_ALIAS_REGEX = '#^@ORM#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpAttribute\AnnotationToAttributeMapper
|
||||
@ -53,6 +48,11 @@ final class PhpNestedAttributeGroupFactory
|
||||
* @var \Rector\PhpAttribute\AttributeArrayNameInliner
|
||||
*/
|
||||
private $attributeArrayNameInliner;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/g3d9jy/1
|
||||
*/
|
||||
private const SHORT_ORM_ALIAS_REGEX = '#^@ORM#';
|
||||
public function __construct(AnnotationToAttributeMapper $annotationToAttributeMapper, \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory, \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory, ExprParameterReflectionTypeCorrector $exprParameterReflectionTypeCorrector, AttributeArrayNameInliner $attributeArrayNameInliner)
|
||||
{
|
||||
$this->annotationToAttributeMapper = $annotationToAttributeMapper;
|
||||
|
@ -6,15 +6,15 @@ namespace Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
final class CallablePhpDocNodeVisitor extends \Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor
|
||||
{
|
||||
/**
|
||||
* @var callable(Node, string|null): (int|null|Node)
|
||||
*/
|
||||
private $callable;
|
||||
/**
|
||||
* @readonly
|
||||
* @var string|null
|
||||
*/
|
||||
private $docContent;
|
||||
/**
|
||||
* @var callable(Node, string|null): (int|null|Node)
|
||||
*/
|
||||
private $callable;
|
||||
/**
|
||||
* @param callable(Node $callable, string|null $docContent): (int|null|Node) $callable
|
||||
*/
|
||||
|
@ -18,10 +18,6 @@ use Rector\PostRector\Rector\UseAddingPostRector;
|
||||
use Rector\Skipper\Skipper\Skipper;
|
||||
final class PostFileProcessor
|
||||
{
|
||||
/**
|
||||
* @var PostRectorInterface[]
|
||||
*/
|
||||
private $postRectors = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Skipper\Skipper\Skipper
|
||||
@ -37,6 +33,10 @@ final class PostFileProcessor
|
||||
* @var \Rector\Core\Logging\CurrentRectorProvider
|
||||
*/
|
||||
private $currentRectorProvider;
|
||||
/**
|
||||
* @var PostRectorInterface[]
|
||||
*/
|
||||
private $postRectors = [];
|
||||
public function __construct(
|
||||
Skipper $skipper,
|
||||
CurrentFileProvider $currentFileProvider,
|
||||
|
@ -12,15 +12,15 @@ use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||
*/
|
||||
final class PropertyToAddCollector implements NodeCollectorInterface
|
||||
{
|
||||
/**
|
||||
* @var array<string, PropertyMetadata[]>
|
||||
*/
|
||||
private $propertiesByClass = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\ChangesReporting\Collector\RectorChangeCollector
|
||||
*/
|
||||
private $rectorChangeCollector;
|
||||
/**
|
||||
* @var array<string, PropertyMetadata[]>
|
||||
*/
|
||||
private $propertiesByClass = [];
|
||||
public function __construct(RectorChangeCollector $rectorChangeCollector)
|
||||
{
|
||||
$this->rectorChangeCollector = $rectorChangeCollector;
|
||||
|
@ -14,14 +14,6 @@ use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
final class UseNodesToAddCollector implements NodeCollectorInterface
|
||||
{
|
||||
/**
|
||||
* @var array<string, FullyQualifiedObjectType[]>
|
||||
*/
|
||||
private $functionUseImportTypesInFilePath = [];
|
||||
/**
|
||||
* @var array<string, FullyQualifiedObjectType[]>
|
||||
*/
|
||||
private $useImportTypesInFilePath = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Provider\CurrentFileProvider
|
||||
@ -32,6 +24,14 @@ final class UseNodesToAddCollector implements NodeCollectorInterface
|
||||
* @var \Rector\Naming\Naming\UseImportsResolver
|
||||
*/
|
||||
private $useImportsResolver;
|
||||
/**
|
||||
* @var array<string, FullyQualifiedObjectType[]>
|
||||
*/
|
||||
private $functionUseImportTypesInFilePath = [];
|
||||
/**
|
||||
* @var array<string, FullyQualifiedObjectType[]>
|
||||
*/
|
||||
private $useImportTypesInFilePath = [];
|
||||
public function __construct(CurrentFileProvider $currentFileProvider, UseImportsResolver $useImportsResolver)
|
||||
{
|
||||
$this->currentFileProvider = $currentFileProvider;
|
||||
|
@ -21,10 +21,6 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
final class ClassRenamingPostRector extends \Rector\PostRector\Rector\AbstractPostRector implements PostRectorDependencyInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\Namespace_|null
|
||||
*/
|
||||
private $rootNode = null;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Renaming\NodeManipulator\ClassRenamer
|
||||
@ -45,6 +41,10 @@ final class ClassRenamingPostRector extends \Rector\PostRector\Rector\AbstractPo
|
||||
* @var \Rector\CodingStyle\Application\UseImportsRemover
|
||||
*/
|
||||
private $useImportsRemover;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\Namespace_|null
|
||||
*/
|
||||
private $rootNode = null;
|
||||
public function __construct(ClassRenamer $classRenamer, RenamedClassesDataCollector $renamedClassesDataCollector, RectorConfigProvider $rectorConfigProvider, UseImportsRemover $useImportsRemover)
|
||||
{
|
||||
$this->classRenamer = $classRenamer;
|
||||
|
@ -17,10 +17,6 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper;
|
||||
final class VariableToConstantGuard
|
||||
{
|
||||
/**
|
||||
* @var array<string, array<int>>
|
||||
*/
|
||||
private $referencePositionsByFunctionName = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -31,6 +27,10 @@ final class VariableToConstantGuard
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var array<string, array<int>>
|
||||
*/
|
||||
private $referencePositionsByFunctionName = [];
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -8,10 +8,6 @@ use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Configuration\Parameter\ParameterProvider;
|
||||
final class SkippedClassResolver
|
||||
{
|
||||
/**
|
||||
* @var array<string, string[]|null>
|
||||
*/
|
||||
private $skippedClasses = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Configuration\Parameter\ParameterProvider
|
||||
@ -22,6 +18,10 @@ final class SkippedClassResolver
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var array<string, string[]|null>
|
||||
*/
|
||||
private $skippedClasses = [];
|
||||
public function __construct(ParameterProvider $parameterProvider, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->parameterProvider = $parameterProvider;
|
||||
|
@ -11,10 +11,6 @@ use Rector\Core\FileSystem\FilePathHelper;
|
||||
*/
|
||||
final class SkippedPathsResolver
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $skippedPaths = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Configuration\Parameter\ParameterProvider
|
||||
@ -25,6 +21,10 @@ final class SkippedPathsResolver
|
||||
* @var \Rector\Core\FileSystem\FilePathHelper
|
||||
*/
|
||||
private $filePathHelper;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $skippedPaths = [];
|
||||
public function __construct(ParameterProvider $parameterProvider, FilePathHelper $filePathHelper)
|
||||
{
|
||||
$this->parameterProvider = $parameterProvider;
|
||||
|
@ -8,10 +8,6 @@ use Rector\Skipper\Matcher\FileInfoMatcher;
|
||||
use Rector\Skipper\SkipCriteriaResolver\SkippedPathsResolver;
|
||||
final class PathSkipVoter implements SkipVoterInterface
|
||||
{
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $skippedFiles = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Skipper\Matcher\FileInfoMatcher
|
||||
@ -22,6 +18,10 @@ final class PathSkipVoter implements SkipVoterInterface
|
||||
* @var \Rector\Skipper\SkipCriteriaResolver\SkippedPathsResolver
|
||||
*/
|
||||
private $skippedPathsResolver;
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $skippedFiles = [];
|
||||
public function __construct(FileInfoMatcher $fileInfoMatcher, SkippedPathsResolver $skippedPathsResolver)
|
||||
{
|
||||
$this->fileInfoMatcher = $fileInfoMatcher;
|
||||
|
@ -17,15 +17,15 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class UnionTypeMapper implements PhpDocTypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper
|
||||
*/
|
||||
private $phpDocTypeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory
|
||||
*/
|
||||
private $typeFactory;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper
|
||||
*/
|
||||
private $phpDocTypeMapper;
|
||||
public function __construct(TypeFactory $typeFactory)
|
||||
{
|
||||
$this->typeFactory = $typeFactory;
|
||||
|
@ -16,15 +16,15 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class NullableTypeNodeMapper implements PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
|
||||
*/
|
||||
private $phpParserNodeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory
|
||||
*/
|
||||
private $typeFactory;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
|
||||
*/
|
||||
private $phpParserNodeMapper;
|
||||
public function __construct(TypeFactory $typeFactory)
|
||||
{
|
||||
$this->typeFactory = $typeFactory;
|
||||
|
@ -15,15 +15,15 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class UnionTypeNodeMapper implements PhpParserNodeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
|
||||
*/
|
||||
private $phpParserNodeMapper;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory
|
||||
*/
|
||||
private $typeFactory;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
|
||||
*/
|
||||
private $phpParserNodeMapper;
|
||||
public function __construct(TypeFactory $typeFactory)
|
||||
{
|
||||
$this->typeFactory = $typeFactory;
|
||||
|
@ -33,10 +33,6 @@ use Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper;
|
||||
*/
|
||||
final class StaticTypeMapper
|
||||
{
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const STANDALONE_MAPS = ['false' => 'bool'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\StaticTypeMapper\Naming\NameScopeFactory
|
||||
@ -62,6 +58,10 @@ final class StaticTypeMapper
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const STANDALONE_MAPS = ['false' => 'bool'];
|
||||
public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper, NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->nameScopeFactory = $nameScopeFactory;
|
||||
|
@ -25,10 +25,6 @@ use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
|
||||
use Rector\VendorLocker\ParentClassMethodTypeOverrideGuard;
|
||||
final class ClassMethodReturnTypeOverrideGuard
|
||||
{
|
||||
/**
|
||||
* @var array<class-string, array<string>>
|
||||
*/
|
||||
private const CHAOTIC_CLASS_METHOD_NAMES = ['PhpParser\\NodeVisitor' => ['enterNode', 'leaveNode', 'beforeTraverse', 'afterTraverse']];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -74,6 +70,10 @@ final class ClassMethodReturnTypeOverrideGuard
|
||||
* @var \Rector\Core\FileSystem\FilePathHelper
|
||||
*/
|
||||
private $filePathHelper;
|
||||
/**
|
||||
* @var array<class-string, array<string>>
|
||||
*/
|
||||
private const CHAOTIC_CLASS_METHOD_NAMES = ['PhpParser\\NodeVisitor' => ['enterNode', 'leaveNode', 'beforeTraverse', 'afterTraverse']];
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, FamilyRelationsAnalyzer $familyRelationsAnalyzer, BetterNodeFinder $betterNodeFinder, AstResolver $astResolver, ReflectionResolver $reflectionResolver, ReturnTypeInferer $returnTypeInferer, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, FilePathHelper $filePathHelper)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -11,6 +11,11 @@ use Rector\Core\Enum\ObjectReference;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class ArgumentAddingScope
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
@ -26,11 +31,6 @@ final class ArgumentAddingScope
|
||||
* @var string
|
||||
*/
|
||||
public const SCOPE_CLASS_METHOD = 'class_method';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -35,14 +35,6 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class ArgumentAdderRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var ArgumentAdder[]
|
||||
*/
|
||||
private $addedArguments = [];
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $haveArgumentsChanged = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Arguments\NodeAnalyzer\ArgumentAddingScope
|
||||
@ -63,6 +55,14 @@ final class ArgumentAdderRector extends AbstractRector implements ConfigurableRe
|
||||
* @var \Rector\Core\PhpParser\Printer\BetterStandardPrinter
|
||||
*/
|
||||
private $betterStandardPrinter;
|
||||
/**
|
||||
* @var ArgumentAdder[]
|
||||
*/
|
||||
private $addedArguments = [];
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $haveArgumentsChanged = \false;
|
||||
public function __construct(ArgumentAddingScope $argumentAddingScope, ChangedArgumentsDetector $changedArgumentsDetector, AstResolver $astResolver, BetterStandardPrinter $betterStandardPrinter)
|
||||
{
|
||||
$this->argumentAddingScope = $argumentAddingScope;
|
||||
|
@ -20,15 +20,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class ReplaceArgumentDefaultValueRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var ReplaceArgumentDefaultValue[]
|
||||
*/
|
||||
private $replacedArguments = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Arguments\ArgumentDefaultValueReplacer
|
||||
*/
|
||||
private $argumentDefaultValueReplacer;
|
||||
/**
|
||||
* @var ReplaceArgumentDefaultValue[]
|
||||
*/
|
||||
private $replacedArguments = [];
|
||||
public function __construct(ArgumentDefaultValueReplacer $argumentDefaultValueReplacer)
|
||||
{
|
||||
$this->argumentDefaultValueReplacer = $argumentDefaultValueReplacer;
|
||||
|
@ -20,15 +20,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class FunctionArgumentDefaultValueReplacerRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var ReplaceFuncCallArgumentDefaultValue[]
|
||||
*/
|
||||
private $replacedArguments = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Arguments\ArgumentDefaultValueReplacer
|
||||
*/
|
||||
private $argumentDefaultValueReplacer;
|
||||
/**
|
||||
* @var ReplaceFuncCallArgumentDefaultValue[]
|
||||
*/
|
||||
private $replacedArguments = [];
|
||||
public function __construct(ArgumentDefaultValueReplacer $argumentDefaultValueReplacer)
|
||||
{
|
||||
$this->argumentDefaultValueReplacer = $argumentDefaultValueReplacer;
|
||||
|
@ -8,10 +8,6 @@ use Rector\Arguments\Contract\ReplaceArgumentDefaultValueInterface;
|
||||
use Rector\Core\Validation\RectorAssert;
|
||||
final class ReplaceArgumentDefaultValue implements ReplaceArgumentDefaultValueInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ANY_VALUE_BEFORE = '*ANY_VALUE_BEFORE*';
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
@ -37,6 +33,10 @@ final class ReplaceArgumentDefaultValue implements ReplaceArgumentDefaultValueIn
|
||||
* @var mixed
|
||||
*/
|
||||
private $valueAfter;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ANY_VALUE_BEFORE = '*ANY_VALUE_BEFORE*';
|
||||
/**
|
||||
* @param int<0, max> $position
|
||||
* @param mixed $valueBefore
|
||||
|
@ -26,10 +26,6 @@ use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
||||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class LocalPropertyAnalyzer
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const LARAVEL_COLLECTION_CLASS = 'Illuminate\\Support\\Collection';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser
|
||||
@ -65,6 +61,10 @@ final class LocalPropertyAnalyzer
|
||||
* @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory
|
||||
*/
|
||||
private $typeFactory;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const LARAVEL_COLLECTION_CLASS = 'Illuminate\\Support\\Collection';
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, ArrayDimFetchTypeResolver $arrayDimFetchTypeResolver, NodeTypeResolver $nodeTypeResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, TypeFactory $typeFactory)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
|
@ -28,15 +28,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class ThrowWithPreviousExceptionRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const DEFAULT_EXCEPTION_ARGUMENT_POSITION = 2;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const DEFAULT_EXCEPTION_ARGUMENT_POSITION = 2;
|
||||
public function __construct(ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
|
@ -24,15 +24,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class GetClassToInstanceOfRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const NO_NAMESPACED_CLASSNAMES = ['self', 'static'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeManipulator\BinaryOpManipulator
|
||||
*/
|
||||
private $binaryOpManipulator;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const NO_NAMESPACED_CLASSNAMES = ['self', 'static'];
|
||||
public function __construct(BinaryOpManipulator $binaryOpManipulator)
|
||||
{
|
||||
$this->binaryOpManipulator = $binaryOpManipulator;
|
||||
|
@ -21,15 +21,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class SimplifyIfElseToTernaryRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const LINE_LENGTH_LIMIT = 120;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Printer\BetterStandardPrinter
|
||||
*/
|
||||
private $betterStandardPrinter;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private const LINE_LENGTH_LIMIT = 120;
|
||||
public function __construct(BetterStandardPrinter $betterStandardPrinter)
|
||||
{
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
|
@ -31,19 +31,6 @@ use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
final class ShortNameResolver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/KphLd2/1
|
||||
*/
|
||||
private const BIG_LETTER_START_REGEX = '#^[A-Z]#';
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $shortNamesByFilePath = [];
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser
|
||||
@ -69,6 +56,19 @@ final class ShortNameResolver
|
||||
* @var \Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher
|
||||
*/
|
||||
private $useImportNameMatcher;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/KphLd2/1
|
||||
*/
|
||||
private const BIG_LETTER_START_REGEX = '#^[A-Z]#';
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $shortNamesByFilePath = [];
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder, UseImportNameMatcher $useImportNameMatcher)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
|
@ -23,10 +23,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
final class NameImporter
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $aliasedUses = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\CodingStyle\ClassNameImport\AliasUsesResolver
|
||||
@ -57,6 +53,10 @@ final class NameImporter
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $aliasedUses = [];
|
||||
public function __construct(AliasUsesResolver $aliasUsesResolver, ClassNameImportSkipper $classNameImportSkipper, ParameterProvider $parameterProvider, StaticTypeMapper $staticTypeMapper, UseNodesToAddCollector $useNodesToAddCollector, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->aliasUsesResolver = $aliasUsesResolver;
|
||||
|
@ -16,13 +16,6 @@ use Rector\Naming\Naming\UseImportsResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class UseImportNameMatcher
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @see https://regex101.com/r/ZxFSlc/1 for last name, eg: Entity and UniqueEntity
|
||||
* @see https://regex101.com/r/OLO0Un/1 for inside namespace, eg: ORM for ORM\Id or ORM\Column
|
||||
*/
|
||||
private const SHORT_NAME_REGEX = '#^%s(\\\\[\\w]+)?$#i';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
@ -33,6 +26,13 @@ final class UseImportNameMatcher
|
||||
* @var \Rector\Naming\Naming\UseImportsResolver
|
||||
*/
|
||||
private $useImportsResolver;
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @see https://regex101.com/r/ZxFSlc/1 for last name, eg: Entity and UniqueEntity
|
||||
* @see https://regex101.com/r/OLO0Un/1 for inside namespace, eg: ORM for ORM\Id or ORM\Column
|
||||
*/
|
||||
private const SHORT_NAME_REGEX = '#^%s(\\\\[\\w]+)?$#i';
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, UseImportsResolver $useImportsResolver)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -29,11 +29,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class CatchExceptionNameMatchingTypeRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/xmfMAX/1
|
||||
*/
|
||||
private const STARTS_WITH_ABBREVIATION_REGEX = '#^([A-Za-z]+?)([A-Z]{1}[a-z]{1})([A-Za-z]*)#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\Naming\PropertyNaming
|
||||
@ -44,6 +39,11 @@ final class CatchExceptionNameMatchingTypeRector extends AbstractRector
|
||||
* @var \Rector\Naming\Naming\AliasNameResolver
|
||||
*/
|
||||
private $aliasNameResolver;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/xmfMAX/1
|
||||
*/
|
||||
private const STARTS_WITH_ABBREVIATION_REGEX = '#^([A-Za-z]+?)([A-Z]{1}[a-z]{1})([A-Za-z]*)#';
|
||||
public function __construct(PropertyNaming $propertyNaming, AliasNameResolver $aliasNameResolver)
|
||||
{
|
||||
$this->propertyNaming = $propertyNaming;
|
||||
|
@ -25,15 +25,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class ReturnArrayClassMethodToYieldRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var ReturnArrayClassMethodToyield[]
|
||||
*/
|
||||
private $methodsToYields = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\NodeTransformer
|
||||
*/
|
||||
private $nodeTransformer;
|
||||
/**
|
||||
* @var ReturnArrayClassMethodToyield[]
|
||||
*/
|
||||
private $methodsToYields = [];
|
||||
public function __construct(NodeTransformer $nodeTransformer)
|
||||
{
|
||||
$this->nodeTransformer = $nodeTransformer;
|
||||
|
@ -26,15 +26,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class VersionCompareFuncCallToConstantRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var array<string, class-string<BinaryOp>>
|
||||
*/
|
||||
private const OPERATOR_TO_COMPARISON = ['=' => Identical::class, '==' => Identical::class, 'eq' => Identical::class, '!=' => NotIdentical::class, '<>' => NotIdentical::class, 'ne' => NotIdentical::class, '>' => Greater::class, 'gt' => Greater::class, '<' => Smaller::class, 'lt' => Smaller::class, '>=' => GreaterOrEqual::class, 'ge' => GreaterOrEqual::class, '<=' => SmallerOrEqual::class, 'le' => SmallerOrEqual::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Util\PhpVersionFactory
|
||||
*/
|
||||
private $phpVersionFactory;
|
||||
/**
|
||||
* @var array<string, class-string<BinaryOp>>
|
||||
*/
|
||||
private const OPERATOR_TO_COMPARISON = ['=' => Identical::class, '==' => Identical::class, 'eq' => Identical::class, '!=' => NotIdentical::class, '<>' => NotIdentical::class, 'ne' => NotIdentical::class, '>' => Greater::class, 'gt' => Greater::class, '<' => Smaller::class, 'lt' => Smaller::class, '>=' => GreaterOrEqual::class, 'ge' => GreaterOrEqual::class, '<=' => SmallerOrEqual::class, 'le' => SmallerOrEqual::class];
|
||||
public function __construct(PhpVersionFactory $phpVersionFactory)
|
||||
{
|
||||
$this->phpVersionFactory = $phpVersionFactory;
|
||||
|
@ -22,6 +22,11 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class PreferThisOrSelfMethodCallRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -30,11 +35,6 @@ final class PreferThisOrSelfMethodCallRector extends AbstractRector implements C
|
||||
* @var array<string, PreferenceSelfThis::*>
|
||||
*/
|
||||
private $typeToPreference = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(AstResolver $astResolver)
|
||||
{
|
||||
$this->astResolver = $astResolver;
|
||||
|
@ -18,16 +18,16 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class UseClassKeywordForClassNameResolutionRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/Vv41Qr/1/
|
||||
*/
|
||||
private const CLASS_BEFORE_STATIC_ACCESS_REGEX = '#(?<class_name>[\\\\a-zA-Z0-9_\\x80-\\xff]*)::#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/Vv41Qr/1/
|
||||
*/
|
||||
private const CLASS_BEFORE_STATIC_ACCESS_REGEX = '#(?<class_name>[\\\\a-zA-Z0-9_\\x80-\\xff]*)::#';
|
||||
public function __construct(ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
|
@ -11,10 +11,6 @@ use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class VariadicFunctionLikeDetector
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const VARIADIC_FUNCTION_NAMES = ['func_get_arg', 'func_get_args', 'func_num_args'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser
|
||||
@ -25,6 +21,10 @@ final class VariadicFunctionLikeDetector
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const VARIADIC_FUNCTION_NAMES = ['func_get_arg', 'func_get_args', 'func_num_args'];
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
|
@ -20,10 +20,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RemoveDuplicatedArrayKeyRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const ALLOWED_KEY_DUPLICATES = [PreInc::class, PreDec::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Printer\BetterStandardPrinter
|
||||
@ -34,6 +30,10 @@ final class RemoveDuplicatedArrayKeyRector extends AbstractRector
|
||||
* @var \Rector\Core\Util\MultiInstanceofChecker
|
||||
*/
|
||||
private $multiInstanceofChecker;
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const ALLOWED_KEY_DUPLICATES = [PreInc::class, PreDec::class];
|
||||
public function __construct(BetterStandardPrinter $betterStandardPrinter, MultiInstanceofChecker $multiInstanceofChecker)
|
||||
{
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
|
@ -39,10 +39,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RecastingRemovalRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Node>, class-string<Type>>
|
||||
*/
|
||||
private const CAST_CLASS_TO_NODE_TYPE = [String_::class => StringType::class, Bool_::class => BooleanType::class, Array_::class => ArrayType::class, Int_::class => IntegerType::class, Object_::class => ObjectType::class, Double::class => FloatType::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer
|
||||
@ -63,6 +59,10 @@ final class RecastingRemovalRector extends AbstractRector
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
/**
|
||||
* @var array<class-string<Node>, class-string<Type>>
|
||||
*/
|
||||
private const CAST_CLASS_TO_NODE_TYPE = [String_::class => StringType::class, Bool_::class => BooleanType::class, Array_::class => ArrayType::class, Int_::class => IntegerType::class, Object_::class => ObjectType::class, Double::class => FloatType::class];
|
||||
public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer, ReflectionResolver $reflectionResolver, ExprAnalyzer $exprAnalyzer, AstResolver $astResolver)
|
||||
{
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
|
@ -20,15 +20,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class RemoveAnnotationRector extends AbstractRector implements ConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $annotationsToRemove = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover
|
||||
*/
|
||||
private $phpDocTagRemover;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $annotationsToRemove = [];
|
||||
public function __construct(PhpDocTagRemover $phpDocTagRemover)
|
||||
{
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
|
@ -23,14 +23,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RemoveDelegatingParentCallRector extends AbstractScopeAwareRector
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_ANNOTATIONS = ['Route', 'required'];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_ATTRIBUTES = ['Symfony\\Component\\Routing\\Annotation\\Route', 'Symfony\\Contracts\\Service\\Attribute\\Required'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\Comparator\CurrentAndParentClassMethodComparator
|
||||
@ -41,6 +33,14 @@ final class RemoveDelegatingParentCallRector extends AbstractScopeAwareRector
|
||||
* @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer
|
||||
*/
|
||||
private $phpAttributeAnalyzer;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_ANNOTATIONS = ['Route', 'required'];
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private const ALLOWED_ATTRIBUTES = ['Symfony\\Component\\Routing\\Annotation\\Route', 'Symfony\\Contracts\\Service\\Attribute\\Required'];
|
||||
public function __construct(CurrentAndParentClassMethodComparator $currentAndParentClassMethodComparator, PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||
{
|
||||
$this->currentAndParentClassMethodComparator = $currentAndParentClassMethodComparator;
|
||||
|
@ -23,15 +23,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RemovePhpVersionIdCheckRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var PhpVersion::*|null
|
||||
*/
|
||||
private $phpVersion = null;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
/**
|
||||
* @var PhpVersion::*|null
|
||||
*/
|
||||
private $phpVersion = null;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
|
@ -34,10 +34,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RemoveNonExistingVarAnnotationRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const NODES_TO_MATCH = [Assign::class, AssignRef::class, Foreach_::class, Static_::class, Echo_::class, Return_::class, Expression::class, Throw_::class, If_::class, While_::class, Switch_::class, Nop::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer
|
||||
@ -48,6 +44,10 @@ final class RemoveNonExistingVarAnnotationRector extends AbstractRector
|
||||
* @var \Rector\Core\Util\MultiInstanceofChecker
|
||||
*/
|
||||
private $multiInstanceofChecker;
|
||||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const NODES_TO_MATCH = [Assign::class, AssignRef::class, Foreach_::class, Static_::class, Echo_::class, Return_::class, Expression::class, Throw_::class, If_::class, While_::class, Switch_::class, Nop::class];
|
||||
public function __construct(ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer, MultiInstanceofChecker $multiInstanceofChecker)
|
||||
{
|
||||
$this->exprUsedInNodeAnalyzer = $exprUsedInNodeAnalyzer;
|
||||
|
@ -11,6 +11,16 @@ use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class PureFunctionDetector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @see https://github.com/vimeo/psalm/blob/d470903722cfcbc1cd04744c5491d3e6d13ec3d9/src/Psalm/Internal/Codebase/Functions.php#L288
|
||||
* @var string[]
|
||||
@ -225,16 +235,6 @@ final class PureFunctionDetector
|
||||
// stream
|
||||
'stream_filter_append',
|
||||
];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -25,14 +25,6 @@ use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
final class SideEffectNodeDetector
|
||||
{
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const SIDE_EFFECT_NODE_TYPES = [Encapsed::class, New_::class, Concat::class, PropertyFetch::class];
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const CALL_EXPR_SIDE_EFFECT_NODE_TYPES = [MethodCall::class, New_::class, NullsafeMethodCall::class, StaticCall::class];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
@ -43,6 +35,14 @@ final class SideEffectNodeDetector
|
||||
* @var \Rector\DeadCode\SideEffect\PureFunctionDetector
|
||||
*/
|
||||
private $pureFunctionDetector;
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const SIDE_EFFECT_NODE_TYPES = [Encapsed::class, New_::class, Concat::class, PropertyFetch::class];
|
||||
/**
|
||||
* @var array<class-string<Expr>>
|
||||
*/
|
||||
private const CALL_EXPR_SIDE_EFFECT_NODE_TYPES = [MethodCall::class, New_::class, NullsafeMethodCall::class, StaticCall::class];
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, \Rector\DeadCode\SideEffect\PureFunctionDetector $pureFunctionDetector)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
|
@ -11,6 +11,11 @@ use Rector\Core\Util\StringUtils;
|
||||
*/
|
||||
final class InflectorSingularResolver
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Doctrine\Inflector\Inflector
|
||||
*/
|
||||
private $inflector;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
@ -29,11 +34,6 @@ final class InflectorSingularResolver
|
||||
* @var string
|
||||
*/
|
||||
private const CAMELCASE = 'camelcase';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Doctrine\Inflector\Inflector
|
||||
*/
|
||||
private $inflector;
|
||||
public function __construct(Inflector $inflector)
|
||||
{
|
||||
$this->inflector = $inflector;
|
||||
|
@ -32,11 +32,6 @@ use Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper;
|
||||
*/
|
||||
final class BreakingVariableRenameGuard
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/1pKLgf/1
|
||||
*/
|
||||
public const AT_NAMING_REGEX = '#[\\w+]At$#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
@ -67,6 +62,11 @@ final class BreakingVariableRenameGuard
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/1pKLgf/1
|
||||
*/
|
||||
public const AT_NAMING_REGEX = '#[\\w+]At$#';
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, ConflictingNameResolver $conflictingNameResolver, NodeTypeResolver $nodeTypeResolver, OverridenExistingNamesResolver $overridenExistingNamesResolver, TypeUnwrapper $typeUnwrapper, NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
|
@ -14,10 +14,6 @@ use Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver;
|
||||
use Rector\Naming\PhpArray\ArrayFilter;
|
||||
final class ConflictingNameResolver
|
||||
{
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $conflictingVariableNamesByClassMethod = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\PhpArray\ArrayFilter
|
||||
@ -43,6 +39,10 @@ final class ConflictingNameResolver
|
||||
* @var \Rector\Core\NodeManipulator\FunctionLikeManipulator
|
||||
*/
|
||||
private $functionLikeManipulator;
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private $conflictingVariableNamesByClassMethod = [];
|
||||
public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, FunctionLikeManipulator $functionLikeManipulator)
|
||||
{
|
||||
$this->arrayFilter = $arrayFilter;
|
||||
|
@ -14,10 +14,6 @@ use Rector\Naming\PhpArray\ArrayFilter;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class OverridenExistingNamesResolver
|
||||
{
|
||||
/**
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
private $overridenExistingVariableNamesByClassMethod = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\PhpArray\ArrayFilter
|
||||
@ -33,6 +29,10 @@ final class OverridenExistingNamesResolver
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
private $overridenExistingVariableNamesByClassMethod = [];
|
||||
public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->arrayFilter = $arrayFilter;
|
||||
|
@ -23,6 +23,16 @@ use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
|
||||
*/
|
||||
final class PropertyNaming
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\RectorNamingInflector
|
||||
*/
|
||||
private $rectorNamingInflector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@ -45,16 +55,6 @@ final class PropertyNaming
|
||||
* @var string
|
||||
*/
|
||||
private const GET_PREFIX_REGEX = '#^get(?<root_name>[A-Z].+)#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\RectorNamingInflector
|
||||
*/
|
||||
private $rectorNamingInflector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
public function __construct(RectorNamingInflector $rectorNamingInflector, NodeTypeResolver $nodeTypeResolver)
|
||||
{
|
||||
$this->rectorNamingInflector = $rectorNamingInflector;
|
||||
|
@ -27,10 +27,6 @@ use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use RectorPrefix202306\Symfony\Component\String\UnicodeString;
|
||||
final class VariableNaming
|
||||
{
|
||||
/**
|
||||
* @var AssignVariableNameResolverInterface[]
|
||||
*/
|
||||
private $assignVariableNameResolvers = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -41,6 +37,10 @@ final class VariableNaming
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var AssignVariableNameResolverInterface[]
|
||||
*/
|
||||
private $assignVariableNameResolvers = [];
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, PropertyFetchAssignVariableNameResolver $propertyFetchAssignVariableNameResolver, NewAssignVariableNameResolver $newAssignVariableNameResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -23,11 +23,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RenameVariableToMatchMethodCallReturnTypeRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/JG5w9j/1
|
||||
*/
|
||||
private const OR_BETWEEN_WORDS_REGEX = '#[a-z]Or[A-Z]#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\Guard\BreakingVariableRenameGuard
|
||||
@ -58,6 +53,11 @@ final class RenameVariableToMatchMethodCallReturnTypeRector extends AbstractRect
|
||||
* @var \Rector\Naming\VariableRenamer
|
||||
*/
|
||||
private $variableRenamer;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/JG5w9j/1
|
||||
*/
|
||||
private const OR_BETWEEN_WORDS_REGEX = '#[a-z]Or[A-Z]#';
|
||||
public function __construct(BreakingVariableRenameGuard $breakingVariableRenameGuard, ExpectedNameResolver $expectedNameResolver, NamingConventionAnalyzer $namingConventionAnalyzer, VarTagValueNodeRenamer $varTagValueNodeRenamer, VariableAndCallAssignMatcher $variableAndCallAssignMatcher, VariableRenamer $variableRenamer)
|
||||
{
|
||||
$this->breakingVariableRenameGuard = $breakingVariableRenameGuard;
|
||||
|
@ -24,10 +24,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RenameParamToMatchTypeRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\Guard\BreakingVariableRenameGuard
|
||||
@ -53,6 +49,10 @@ final class RenameParamToMatchTypeRector extends AbstractRector
|
||||
* @var \Rector\Naming\ParamRenamer\ParamRenamer
|
||||
*/
|
||||
private $paramRenamer;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
public function __construct(BreakingVariableRenameGuard $breakingVariableRenameGuard, ExpectedNameResolver $expectedNameResolver, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, ParamRenameFactory $paramRenameFactory, ParamRenamer $paramRenamer)
|
||||
{
|
||||
$this->breakingVariableRenameGuard = $breakingVariableRenameGuard;
|
||||
|
@ -21,10 +21,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class RenamePropertyToMatchTypeRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Naming\PropertyRenamer\MatchTypePropertyRenamer
|
||||
@ -45,6 +41,10 @@ final class RenamePropertyToMatchTypeRector extends AbstractRector
|
||||
* @var \Rector\Naming\PropertyRenamer\PropertyPromotionRenamer
|
||||
*/
|
||||
private $propertyPromotionRenamer;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $hasChanged = \false;
|
||||
public function __construct(MatchTypePropertyRenamer $matchTypePropertyRenamer, PropertyRenameFactory $propertyRenameFactory, MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver, PropertyPromotionRenamer $propertyPromotionRenamer)
|
||||
{
|
||||
$this->matchTypePropertyRenamer = $matchTypePropertyRenamer;
|
||||
|
@ -7,16 +7,16 @@ use RectorPrefix202306\Doctrine\Inflector\Inflector;
|
||||
use RectorPrefix202306\Nette\Utils\Strings;
|
||||
final class RectorNamingInflector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/VqVvke/3
|
||||
*/
|
||||
private const DATA_INFO_SUFFIX_REGEX = '#^(?<prefix>.+)(?<suffix>Data|Info)$#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Doctrine\Inflector\Inflector
|
||||
*/
|
||||
private $inflector;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/VqVvke/3
|
||||
*/
|
||||
private const DATA_INFO_SUFFIX_REGEX = '#^(?<prefix>.+)(?<suffix>Data|Info)$#';
|
||||
public function __construct(Inflector $inflector)
|
||||
{
|
||||
$this->inflector = $inflector;
|
||||
|
@ -27,15 +27,15 @@ use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
*/
|
||||
final class StringClassNameToClassConstantRector extends AbstractScopeAwareRector implements AllowEmptyConfigurableRectorInterface, MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $classesToSkip = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $classesToSkip = [];
|
||||
public function __construct(ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
|
@ -10,6 +10,11 @@ use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
final class RegexMatcher
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/Ok4wuE/1
|
||||
@ -25,11 +30,6 @@ final class RegexMatcher
|
||||
* @see https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
|
||||
*/
|
||||
private const ALL_MODIFIERS_VALUES = ['i', 'm', 's', 'x', 'e', 'A', 'D', 'S', 'U', 'X', 'J', 'u'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
public function __construct(ValueResolver $valueResolver)
|
||||
{
|
||||
$this->valueResolver = $valueResolver;
|
||||
|
@ -12,6 +12,11 @@ use Rector\Php70\Exception\InvalidEregException;
|
||||
*/
|
||||
final class EregToPcreTransformer
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $pcreDelimiter = '#';
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
@ -54,11 +59,6 @@ final class EregToPcreTransformer
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $cache = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var string
|
||||
*/
|
||||
private $pcreDelimiter = '#';
|
||||
/**
|
||||
* Change this via services configuratoin in rector.php if you need it
|
||||
* Single type is chosen to prevent every regular with different delimiter.
|
||||
|
@ -28,15 +28,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class EregToPregMatchRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const OLD_NAMES_TO_NEW_ONES = ['ereg' => 'preg_match', 'eregi' => 'preg_match', 'ereg_replace' => 'preg_replace', 'eregi_replace' => 'preg_replace', 'split' => 'preg_split', 'spliti' => 'preg_split'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Php70\EregToPcreTransformer
|
||||
*/
|
||||
private $eregToPcreTransformer;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const OLD_NAMES_TO_NEW_ONES = ['ereg' => 'preg_match', 'eregi' => 'preg_match', 'ereg_replace' => 'preg_replace', 'eregi_replace' => 'preg_replace', 'split' => 'preg_split', 'spliti' => 'preg_split'];
|
||||
public function __construct(EregToPcreTransformer $eregToPcreTransformer)
|
||||
{
|
||||
$this->eregToPcreTransformer = $eregToPcreTransformer;
|
||||
|
@ -50,11 +50,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use ReflectionParameter;
|
||||
final class AnonymousFunctionFactory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/jkLLlM/2
|
||||
*/
|
||||
private const DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?<number>\\d+)#';
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -105,6 +100,11 @@ final class AnonymousFunctionFactory
|
||||
* @var \Rector\Core\PhpParser\Parser\InlineCodeParser
|
||||
*/
|
||||
private $inlineCodeParser;
|
||||
/**
|
||||
* @var string
|
||||
* @see https://regex101.com/r/jkLLlM/2
|
||||
*/
|
||||
private const DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?<number>\\d+)#';
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, NodeFactory $nodeFactory, StaticTypeMapper $staticTypeMapper, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, SimplePhpParser $simplePhpParser, ClosureNestedUsesDecorator $closureNestedUsesDecorator, AstResolver $astResolver, PrivatesAccessor $privatesAccessor, InlineCodeParser $inlineCodeParser)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
|
@ -21,16 +21,16 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class SensitiveConstantNameRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @see http://php.net/manual/en/reserved.constants.php
|
||||
* @var string[]
|
||||
*/
|
||||
private const PHP_RESERVED_CONSTANTS = ['PHP_VERSION', 'PHP_MAJOR_VERSION', 'PHP_MINOR_VERSION', 'PHP_RELEASE_VERSION', 'PHP_VERSION_ID', 'PHP_EXTRA_VERSION', 'PHP_ZTS', 'PHP_DEBUG', 'PHP_MAXPATHLEN', 'PHP_OS', 'PHP_OS_FAMILY', 'PHP_SAPI', 'PHP_EOL', 'PHP_INT_MAX', 'PHP_INT_MIN', 'PHP_INT_SIZE', 'PHP_FLOAT_DIG', 'PHP_FLOAT_EPSILON', 'PHP_FLOAT_MIN', 'PHP_FLOAT_MAX', 'DEFAULT_INCLUDE_PATH', 'PEAR_INSTALL_DIR', 'PEAR_EXTENSION_DIR', 'PHP_EXTENSION_DIR', 'PHP_PREFIX', 'PHP_BINDIR', 'PHP_BINARY', 'PHP_MANDIR', 'PHP_LIBDIR', 'PHP_DATADIR', 'PHP_SYSCONFDIR', 'PHP_LOCALSTATEDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_CONFIG_FILE_SCAN_DIR', 'PHP_SHLIB_SUFFIX', 'PHP_FD_SETSIZE', 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE', 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR', 'E_USER_WARNING', 'E_USER_NOTICE', 'E_RECOVERABLE_ERROR', 'E_DEPRECATED', 'E_USER_DEPRECATED', 'E_ALL', 'E_STRICT', '__COMPILER_HALT_OFFSET__', 'TRUE', 'FALSE', 'NULL'];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @see http://php.net/manual/en/reserved.constants.php
|
||||
* @var string[]
|
||||
*/
|
||||
private const PHP_RESERVED_CONSTANTS = ['PHP_VERSION', 'PHP_MAJOR_VERSION', 'PHP_MINOR_VERSION', 'PHP_RELEASE_VERSION', 'PHP_VERSION_ID', 'PHP_EXTRA_VERSION', 'PHP_ZTS', 'PHP_DEBUG', 'PHP_MAXPATHLEN', 'PHP_OS', 'PHP_OS_FAMILY', 'PHP_SAPI', 'PHP_EOL', 'PHP_INT_MAX', 'PHP_INT_MIN', 'PHP_INT_SIZE', 'PHP_FLOAT_DIG', 'PHP_FLOAT_EPSILON', 'PHP_FLOAT_MIN', 'PHP_FLOAT_MAX', 'DEFAULT_INCLUDE_PATH', 'PEAR_INSTALL_DIR', 'PEAR_EXTENSION_DIR', 'PHP_EXTENSION_DIR', 'PHP_PREFIX', 'PHP_BINDIR', 'PHP_BINARY', 'PHP_MANDIR', 'PHP_LIBDIR', 'PHP_DATADIR', 'PHP_SYSCONFDIR', 'PHP_LOCALSTATEDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_CONFIG_FILE_SCAN_DIR', 'PHP_SHLIB_SUFFIX', 'PHP_FD_SETSIZE', 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE', 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR', 'E_USER_WARNING', 'E_USER_NOTICE', 'E_RECOVERABLE_ERROR', 'E_DEPRECATED', 'E_USER_DEPRECATED', 'E_ALL', 'E_STRICT', '__COMPILER_HALT_OFFSET__', 'TRUE', 'FALSE', 'NULL'];
|
||||
public function __construct(ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user