mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit ce32685688660a000848322caadcf336bfc282f8
ce32685688
[PHPStan] Reduce PHPStan errors for narrow public - take 2 (#2673)
This commit is contained in:
parent
46dd47dd4e
commit
da70700f98
@ -34,6 +34,9 @@ final class CommentsMerger
|
||||
// remove so comments "win"
|
||||
$newNode->setAttribute(AttributeKey::PHP_DOC_INFO, null);
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function keepParent(Node $newNode, Node $oldNode) : void
|
||||
{
|
||||
$parent = $oldNode->getAttribute(AttributeKey::PARENT_NODE);
|
||||
@ -48,6 +51,9 @@ final class CommentsMerger
|
||||
$newNode->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo);
|
||||
$newNode->setAttribute(AttributeKey::COMMENTS, $comments);
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function keepChildren(Node $newNode, Node $oldNode) : void
|
||||
{
|
||||
$childrenComments = $this->collectChildrenComments($oldNode);
|
||||
|
@ -115,6 +115,9 @@ final class PhpDocInfoFactory
|
||||
$this->phpDocInfosByObjectHash[$objectHash] = $phpDocInfo;
|
||||
return $phpDocInfo;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function createEmpty(Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
/** @see \Rector\BetterPhpDocParser\PhpDocParser\DoctrineAnnotationDecorator::decorate() */
|
||||
|
@ -3,7 +3,7 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Caching\FileSystem;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PHPStan\Analyser\MutatingScope;
|
||||
use PHPStan\Analyser\NodeScopeResolver;
|
||||
use PHPStan\Dependency\DependencyResolver as PHPStanDependencyResolver;
|
||||
@ -34,10 +34,10 @@ final class DependencyResolver
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function resolveDependencies(Node $node, MutatingScope $mutatingScope) : array
|
||||
public function resolveDependencies(Stmt $stmt, MutatingScope $mutatingScope) : array
|
||||
{
|
||||
$analysedFileAbsolutesPaths = $this->privatesAccessor->getPrivateProperty($this->nodeScopeResolver, 'analysedFiles');
|
||||
$nodeDependencies = $this->phpStanDependencyResolver->resolveDependencies($node, $mutatingScope);
|
||||
$nodeDependencies = $this->phpStanDependencyResolver->resolveDependencies($stmt, $mutatingScope);
|
||||
return $nodeDependencies->getFileDependencies($mutatingScope->getFile(), $analysedFileAbsolutesPaths);
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ final class CommentRemover
|
||||
$this->commentRemovingNodeTraverser = $commentRemovingNodeTraverser;
|
||||
}
|
||||
/**
|
||||
* @return Node[]|null
|
||||
* @param mixed[]|\PhpParser\Node|null $node
|
||||
* @return Node[]|null
|
||||
*/
|
||||
public function removeFromNode($node)
|
||||
{
|
||||
|
@ -87,6 +87,9 @@ final class NodeNameResolver
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function isCaseSensitiveName(Node $node, string $name) : bool
|
||||
{
|
||||
if ($name === '') {
|
||||
|
@ -51,10 +51,16 @@ final class ContextAnalyzer
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function isInSwitch(Node $node) : bool
|
||||
{
|
||||
return (bool) $this->betterNodeFinder->findParentType($node, Switch_::class);
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function isInIf(Node $node) : bool
|
||||
{
|
||||
$breakNodes = \array_merge([If_::class], self::BREAK_NODES);
|
||||
|
@ -22,6 +22,7 @@ final class ScopeAwareNodeFinder
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
* Find node based on $callable or null, when the nesting scope is broken
|
||||
* @param callable(Node $node): bool $callable
|
||||
* @param array<class-string<Node>> $allowedTypes
|
||||
|
@ -5,6 +5,7 @@ namespace Rector\NodeTypeResolver\NodeTypeCorrector;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PHPStan\Type\ArrayType;
|
||||
@ -55,15 +56,15 @@ final class PregMatchTypeCorrector
|
||||
* Special case for "preg_match(), preg_match_all()" - with 3rd argument
|
||||
* @see https://github.com/rectorphp/rector/issues/786
|
||||
*/
|
||||
public function correct(Node $node, Type $originalType) : Type
|
||||
public function correct(Expr $expr, Type $originalType) : Type
|
||||
{
|
||||
if (!$node instanceof Variable) {
|
||||
if (!$expr instanceof Variable) {
|
||||
return $originalType;
|
||||
}
|
||||
if ($originalType instanceof ArrayType) {
|
||||
return $originalType;
|
||||
}
|
||||
$variableUsages = $this->getVariableUsages($node);
|
||||
$variableUsages = $this->getVariableUsages($expr);
|
||||
foreach ($variableUsages as $variableUsage) {
|
||||
$possiblyArg = $variableUsage->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$possiblyArg instanceof Arg) {
|
||||
@ -82,7 +83,7 @@ final class PregMatchTypeCorrector
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $funcCallNode->args[2];
|
||||
// are the same variables
|
||||
if (!$this->nodeComparator->areNodesEqual($thirdArg->value, $node)) {
|
||||
if (!$this->nodeComparator->areNodesEqual($thirdArg->value, $expr)) {
|
||||
continue;
|
||||
}
|
||||
return new ArrayType(new MixedType(), new MixedType());
|
||||
|
@ -16,6 +16,7 @@ use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Broker\ClassAutoloadingException;
|
||||
@ -233,15 +234,16 @@ final class NodeTypeResolver
|
||||
$type = $scope->getNativeType($expr);
|
||||
return $this->accessoryNonEmptyStringTypeCorrector->correct($type);
|
||||
}
|
||||
public function isNumberType(Node $node) : bool
|
||||
public function isNumberType(Expr $expr) : bool
|
||||
{
|
||||
$nodeType = $this->getType($node);
|
||||
$nodeType = $this->getType($expr);
|
||||
if ($nodeType instanceof IntegerType) {
|
||||
return \true;
|
||||
}
|
||||
return $nodeType instanceof FloatType;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
* @param class-string<Type> $desiredType
|
||||
*/
|
||||
public function isNullableTypeOfSpecificType(Node $node, string $desiredType) : bool
|
||||
|
@ -3,7 +3,7 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NodeTypeResolver\TypeAnalyzer;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
@ -66,19 +66,19 @@ final class ArrayTypeAnalyzer
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
}
|
||||
public function isArrayType(Node $node) : bool
|
||||
public function isArrayType(Expr $expr) : bool
|
||||
{
|
||||
$nodeType = $this->nodeTypeResolver->getType($node);
|
||||
$nodeType = $this->pregMatchTypeCorrector->correct($node, $nodeType);
|
||||
$nodeType = $this->nodeTypeResolver->getType($expr);
|
||||
$nodeType = $this->pregMatchTypeCorrector->correct($expr, $nodeType);
|
||||
if ($this->isIntersectionArrayType($nodeType)) {
|
||||
return \true;
|
||||
}
|
||||
// PHPStan false positive, when variable has type[] docblock, but default array is missing
|
||||
if ($node instanceof PropertyFetch || $node instanceof StaticPropertyFetch) {
|
||||
if ($this->isPropertyFetchWithArrayDefault($node)) {
|
||||
if ($expr instanceof PropertyFetch || $expr instanceof StaticPropertyFetch) {
|
||||
if ($this->isPropertyFetchWithArrayDefault($expr)) {
|
||||
return \true;
|
||||
}
|
||||
if ($this->isPropertyFetchWithArrayDocblockWithoutDefault($node)) {
|
||||
if ($this->isPropertyFetchWithArrayDocblockWithoutDefault($expr)) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ final class ArrayTypeAnalyzer
|
||||
if ($nodeType->isExplicitMixed()) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->isPropertyFetchWithArrayDefault($node)) {
|
||||
if ($this->isPropertyFetchWithArrayDefault($expr)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
@ -111,16 +111,16 @@ final class ArrayTypeAnalyzer
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
private function isPropertyFetchWithArrayDocblockWithoutDefault(Node $node) : bool
|
||||
private function isPropertyFetchWithArrayDocblockWithoutDefault(Expr $expr) : bool
|
||||
{
|
||||
if (!$node instanceof PropertyFetch && !$node instanceof StaticPropertyFetch) {
|
||||
if (!$expr instanceof PropertyFetch && !$expr instanceof StaticPropertyFetch) {
|
||||
return \false;
|
||||
}
|
||||
$classLike = $this->betterNodeFinder->findParentType($node, ClassLike::class);
|
||||
$classLike = $this->betterNodeFinder->findParentType($expr, ClassLike::class);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
return \false;
|
||||
}
|
||||
$propertyName = $this->nodeNameResolver->getName($node->name);
|
||||
$propertyName = $this->nodeNameResolver->getName($expr->name);
|
||||
if ($propertyName === null) {
|
||||
return \false;
|
||||
}
|
||||
@ -142,16 +142,16 @@ final class ArrayTypeAnalyzer
|
||||
/**
|
||||
* phpstan bug workaround - https://phpstan.org/r/0443f283-244c-42b8-8373-85e7deb3504c
|
||||
*/
|
||||
private function isPropertyFetchWithArrayDefault(Node $node) : bool
|
||||
private function isPropertyFetchWithArrayDefault(Expr $expr) : bool
|
||||
{
|
||||
if (!$node instanceof PropertyFetch && !$node instanceof StaticPropertyFetch) {
|
||||
if (!$expr instanceof PropertyFetch && !$expr instanceof StaticPropertyFetch) {
|
||||
return \false;
|
||||
}
|
||||
$classLike = $this->betterNodeFinder->findParentType($node, ClassLike::class);
|
||||
$classLike = $this->betterNodeFinder->findParentType($expr, ClassLike::class);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
return \false;
|
||||
}
|
||||
$propertyName = $this->nodeNameResolver->getName($node->name);
|
||||
$propertyName = $this->nodeNameResolver->getName($expr->name);
|
||||
if ($propertyName === null) {
|
||||
return \false;
|
||||
}
|
||||
@ -162,7 +162,7 @@ final class ArrayTypeAnalyzer
|
||||
return $propertyProperty->default instanceof Array_;
|
||||
}
|
||||
// B. another object property
|
||||
$phpPropertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch($node);
|
||||
$phpPropertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch($expr);
|
||||
if ($phpPropertyReflection instanceof PhpPropertyReflection) {
|
||||
$reflectionProperty = $phpPropertyReflection->getNativeReflection();
|
||||
return \is_array($reflectionProperty->getDefaultValue());
|
||||
|
@ -3,7 +3,7 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\NodeTypeResolver\TypeAnalyzer;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\NodeTypeResolver\NodeTypeCorrector\PregMatchTypeCorrector;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
@ -35,15 +35,15 @@ final class CountableTypeAnalyzer
|
||||
$this->pregMatchTypeCorrector = $pregMatchTypeCorrector;
|
||||
$this->countableObjectTypes = [new ObjectType('Countable'), new ObjectType('SimpleXMLElement'), new ObjectType('ResourceBundle')];
|
||||
}
|
||||
public function isCountableType(Node $node) : bool
|
||||
public function isCountableType(Expr $expr) : bool
|
||||
{
|
||||
$nodeType = $this->nodeTypeResolver->getType($node);
|
||||
$nodeType = $this->pregMatchTypeCorrector->correct($node, $nodeType);
|
||||
$nodeType = $this->nodeTypeResolver->getType($expr);
|
||||
$nodeType = $this->pregMatchTypeCorrector->correct($expr, $nodeType);
|
||||
foreach ($this->countableObjectTypes as $countableObjectType) {
|
||||
if ($countableObjectType->isSuperTypeOf($nodeType)->yes()) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return $this->arrayTypeAnalyzer->isArrayType($node);
|
||||
return $this->arrayTypeAnalyzer->isArrayType($expr);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
||||
namespace Rector\PostRector\Collector;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\Provider\CurrentFileProvider;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\Naming\Naming\UseImportsResolver;
|
||||
@ -72,9 +73,9 @@ final class UseNodesToAddCollector implements NodeCollectorInterface
|
||||
}
|
||||
return $objectTypes;
|
||||
}
|
||||
public function hasImport(File $file, Node $node, FullyQualifiedObjectType $fullyQualifiedObjectType) : bool
|
||||
public function hasImport(File $file, Name $name, FullyQualifiedObjectType $fullyQualifiedObjectType) : bool
|
||||
{
|
||||
$useImports = $this->getUseImportTypesByNode($file, $node);
|
||||
$useImports = $this->getUseImportTypesByNode($file, $name);
|
||||
foreach ($useImports as $useImport) {
|
||||
if ($useImport->equals($fullyQualifiedObjectType)) {
|
||||
return \true;
|
||||
|
@ -3,8 +3,8 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\VendorLocker;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver;
|
||||
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver;
|
||||
@ -32,7 +32,10 @@ final class VendorLockResolver
|
||||
$this->classMethodReturnVendorLockResolver = $classMethodReturnVendorLockResolver;
|
||||
$this->propertyTypeVendorLockResolver = $propertyTypeVendorLockResolver;
|
||||
}
|
||||
public function isClassMethodParamLockedIn(Node $node) : bool
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $node
|
||||
*/
|
||||
public function isClassMethodParamLockedIn($node) : bool
|
||||
{
|
||||
if (!$node instanceof ClassMethod) {
|
||||
return \false;
|
||||
|
@ -30,6 +30,9 @@ final class VariadicFunctionLikeDetector
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function isVariadic(FunctionLike $functionLike) : bool
|
||||
{
|
||||
$isVariadic = \false;
|
||||
|
@ -4,13 +4,13 @@ declare (strict_types=1);
|
||||
namespace Rector\DeadCode\TypeNodeAnalyzer;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\SpacingAwareArrayTypeNode;
|
||||
final class MixedArrayTypeNodeAnalyzer
|
||||
{
|
||||
public function hasMixedArrayType(UnionTypeNode $unionTypeNode) : bool
|
||||
public function hasMixedArrayType(BracketsAwareUnionTypeNode $bracketsAwareUnionTypeNode) : bool
|
||||
{
|
||||
$types = $unionTypeNode->types;
|
||||
$types = $bracketsAwareUnionTypeNode->types;
|
||||
foreach ($types as $type) {
|
||||
if ($type instanceof SpacingAwareArrayTypeNode) {
|
||||
$typeNode = $type->type;
|
||||
|
@ -3,7 +3,6 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DogFood\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
@ -41,14 +40,11 @@ final class ContainerConfiguratorCallAnalyzer
|
||||
}
|
||||
return \is_a($serviceClass, RectorInterface::class, \true);
|
||||
}
|
||||
public function isMethodCallNamed(Expr $expr, string $variableName, string $methodName) : bool
|
||||
public function isMethodCallNamed(MethodCall $methodCall, string $variableName, string $methodName) : bool
|
||||
{
|
||||
if (!$expr instanceof MethodCall) {
|
||||
if (!$this->nodeNameResolver->isName($methodCall->var, $variableName)) {
|
||||
return \false;
|
||||
}
|
||||
if (!$this->nodeNameResolver->isName($expr->var, $variableName)) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeNameResolver->isName($expr->name, $methodName);
|
||||
return $this->nodeNameResolver->isName($methodCall->name, $methodName);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ final class VisibilityManipulator
|
||||
$this->addVisibilityFlag($node, Visibility::FINAL);
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
* @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\ClassMethod $node
|
||||
*/
|
||||
public function makeNonFinal($node) : void
|
||||
|
@ -17,12 +17,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'ac94ddd5bd269b17afc339f39af711c02d56b34a';
|
||||
public const PACKAGE_VERSION = 'ce32685688660a000848322caadcf336bfc282f8';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-07-16 16:19:23';
|
||||
public const RELEASE_DATE = '2022-07-17 03:11:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -39,10 +39,7 @@ final class TerminatedNodeAnalyzer
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const ALLOWED_CONTINUE_CURRENT_STMTS = [InlineHTML::class, Nop::class];
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\TryCatch|\PhpParser\Node\Stmt\If_|\PhpParser\Node\Stmt\Switch_|\PhpParser\Node $node
|
||||
*/
|
||||
public function isAlwaysTerminated($node, Node $currentStmt) : bool
|
||||
public function isAlwaysTerminated(Stmt $node, Stmt $currentStmt) : bool
|
||||
{
|
||||
if (\in_array(\get_class($currentStmt), self::ALLOWED_CONTINUE_CURRENT_STMTS, \true)) {
|
||||
return \false;
|
||||
@ -72,7 +69,7 @@ final class TerminatedNodeAnalyzer
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function isTerminatedInLastStmtsSwitch(Switch_ $switch, Node $node) : bool
|
||||
private function isTerminatedInLastStmtsSwitch(Switch_ $switch, Stmt $stmt) : bool
|
||||
{
|
||||
if ($switch->cases === []) {
|
||||
return \false;
|
||||
@ -85,42 +82,42 @@ final class TerminatedNodeAnalyzer
|
||||
if ($case->stmts === [] && isset($switch->cases[$key + 1])) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->isTerminatedInLastStmts($case->stmts, $node)) {
|
||||
if (!$this->isTerminatedInLastStmts($case->stmts, $stmt)) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return $hasDefault;
|
||||
}
|
||||
private function isTerminatedInLastStmtsTryCatch(TryCatch $tryCatch, Node $node) : bool
|
||||
private function isTerminatedInLastStmtsTryCatch(TryCatch $tryCatch, Stmt $stmt) : bool
|
||||
{
|
||||
if ($tryCatch->finally instanceof Finally_ && $this->isTerminatedInLastStmts($tryCatch->finally->stmts, $node)) {
|
||||
if ($tryCatch->finally instanceof Finally_ && $this->isTerminatedInLastStmts($tryCatch->finally->stmts, $stmt)) {
|
||||
return \true;
|
||||
}
|
||||
foreach ($tryCatch->catches as $catch) {
|
||||
if (!$this->isTerminatedInLastStmts($catch->stmts, $node)) {
|
||||
if (!$this->isTerminatedInLastStmts($catch->stmts, $stmt)) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return $this->isTerminatedInLastStmts($tryCatch->stmts, $node);
|
||||
return $this->isTerminatedInLastStmts($tryCatch->stmts, $stmt);
|
||||
}
|
||||
private function isTerminatedInLastStmtsIf(If_ $if, Node $node) : bool
|
||||
private function isTerminatedInLastStmtsIf(If_ $if, Stmt $stmt) : bool
|
||||
{
|
||||
// Without ElseIf_[] and Else_, after If_ is possibly executable
|
||||
if ($if->elseifs === [] && !$if->else instanceof Else_) {
|
||||
return \false;
|
||||
}
|
||||
foreach ($if->elseifs as $elseIf) {
|
||||
if (!$this->isTerminatedInLastStmts($elseIf->stmts, $node)) {
|
||||
if (!$this->isTerminatedInLastStmts($elseIf->stmts, $stmt)) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
if (!$this->isTerminatedInLastStmts($if->stmts, $node)) {
|
||||
if (!$this->isTerminatedInLastStmts($if->stmts, $stmt)) {
|
||||
return \false;
|
||||
}
|
||||
if (!$if->else instanceof Else_) {
|
||||
return \false;
|
||||
}
|
||||
return $this->isTerminatedInLastStmts($if->else->stmts, $node);
|
||||
return $this->isTerminatedInLastStmts($if->else->stmts, $stmt);
|
||||
}
|
||||
/**
|
||||
* @param Stmt[] $stmts
|
||||
|
@ -36,6 +36,7 @@ final class ClassInsertManipulator
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @api
|
||||
* @param \PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassConst|\PhpParser\Node\Stmt\ClassMethod $stmt
|
||||
*/
|
||||
public function addAsFirstMethod(Class_ $class, $stmt) : void
|
||||
|
@ -79,10 +79,10 @@ final class PropertyFetchAssignManipulator
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPropertyNamesOfAssignOfVariable(Node $node, string $paramName) : array
|
||||
public function getPropertyNamesOfAssignOfVariable(ClassMethod $classMethod, string $paramName) : array
|
||||
{
|
||||
$propertyNames = [];
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($node, function (Node $node) use($paramName, &$propertyNames) {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod, function (Node $node) use($paramName, &$propertyNames) {
|
||||
if (!$node instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c::getLoader();
|
||||
return ComposerAutoloaderInit227a1866e9ea4ee32c5211f8e530ed01::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c
|
||||
class ComposerAutoloaderInit227a1866e9ea4ee32c5211f8e530ed01
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit227a1866e9ea4ee32c5211f8e530ed01', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit227a1866e9ea4ee32c5211f8e530ed01', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire1a64da067ec7bf92e7ada32feabff47c($fileIdentifier, $file);
|
||||
composerRequire227a1866e9ea4ee32c5211f8e530ed01($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInit1a64da067ec7bf92e7ada32feabff47c
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire1a64da067ec7bf92e7ada32feabff47c($fileIdentifier, $file)
|
||||
function composerRequire227a1866e9ea4ee32c5211f8e530ed01($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c
|
||||
class ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3416,9 +3416,9 @@ class ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1a64da067ec7bf92e7ada32feabff47c::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit227a1866e9ea4ee32c5211f8e530ed01::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -2415,12 +2415,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "6dd877b709a89b0bb939bdadc757d1122cd0d017"
|
||||
"reference": "2053a16e0fa3f90f5840e4058992266cd9d6233c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/6dd877b709a89b0bb939bdadc757d1122cd0d017",
|
||||
"reference": "6dd877b709a89b0bb939bdadc757d1122cd0d017",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/2053a16e0fa3f90f5840e4058992266cd9d6233c",
|
||||
"reference": "2053a16e0fa3f90f5840e4058992266cd9d6233c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2449,7 +2449,7 @@
|
||||
"symplify\/rule-doc-generator": "^11.0",
|
||||
"symplify\/vendor-patches": "^11.0"
|
||||
},
|
||||
"time": "2022-07-12T13:16:54+00:00",
|
||||
"time": "2022-07-16T16:09:39+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4539d7d'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 97f49a2'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main be4b95a'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 425881a'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bee7c19'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b44203e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6dd877b'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4539d7d'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 97f49a2'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main be4b95a'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 425881a'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bee7c19'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b44203e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2053a16'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user