Skip to content

Commit

Permalink
Updated Rector to commit c9470e4aa3fe841a40b4b92e3c351a84ad9d7dc4
Browse files Browse the repository at this point in the history
rectorphp/rector-src@c9470e4 Skip Doctrine collections in TypedPropertyFromAssignsRector (#6253)
  • Loading branch information
TomasVotruba committed Aug 23, 2024
1 parent 76823a3 commit 85974b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare (strict_types=1);
namespace Rector\Php84\Rector\Param;

use PHPStan\Type\MixedType;
use PhpParser\Node;
use PhpParser\Node\ComplexType;
use PhpParser\Node\Expr\ConstFetch;
Expand All @@ -12,6 +11,7 @@
use PhpParser\Node\NullableType;
use PhpParser\Node\Param;
use PhpParser\Node\UnionType;
use PHPStan\Type\MixedType;
use PHPStan\Type\TypeCombinator;
use Rector\PhpParser\Node\Value\ValueResolver;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover;
use Rector\Doctrine\CodeQuality\Enum\CollectionMapping;
use Rector\Doctrine\NodeAnalyzer\AttrinationFinder;
use Rector\Php74\Guard\MakePropertyTypedGuard;
use Rector\PhpParser\Node\Value\ValueResolver;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
Expand Down Expand Up @@ -74,6 +76,11 @@ final class TypedPropertyFromAssignsRector extends AbstractRector implements Min
* @var \Rector\StaticTypeMapper\StaticTypeMapper
*/
private $staticTypeMapper;
/**
* @readonly
* @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder
*/
private $attrinationFinder;
/**
* @api
* @var string
Expand All @@ -89,7 +96,7 @@ final class TypedPropertyFromAssignsRector extends AbstractRector implements Min
* @var bool
*/
private $inlinePublic = \false;
public function __construct(AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer, PropertyTypeDecorator $propertyTypeDecorator, VarTagRemover $varTagRemover, MakePropertyTypedGuard $makePropertyTypedGuard, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver, StaticTypeMapper $staticTypeMapper)
public function __construct(AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer, PropertyTypeDecorator $propertyTypeDecorator, VarTagRemover $varTagRemover, MakePropertyTypedGuard $makePropertyTypedGuard, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver, StaticTypeMapper $staticTypeMapper, AttrinationFinder $attrinationFinder)
{
$this->allAssignNodePropertyTypeInferer = $allAssignNodePropertyTypeInferer;
$this->propertyTypeDecorator = $propertyTypeDecorator;
Expand All @@ -99,6 +106,7 @@ public function __construct(AllAssignNodePropertyTypeInferer $allAssignNodePrope
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->valueResolver = $valueResolver;
$this->staticTypeMapper = $staticTypeMapper;
$this->attrinationFinder = $attrinationFinder;
}
public function configure(array $configuration) : void
{
Expand Down Expand Up @@ -153,6 +161,10 @@ public function refactor(Node $node) : ?Node
if (!$property->isPrivate() && !$this->inlinePublic) {
continue;
}
// doctrine colleciton is handled in doctrine rules
if ($this->attrinationFinder->hasByMany($property, CollectionMapping::TO_MANY_CLASSES)) {
continue;
}
if (!$classReflection instanceof ClassReflection) {
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '5625c6356945c93c3123407bbb0249daf755c692';
public const PACKAGE_VERSION = 'c9470e4aa3fe841a40b4b92e3c351a84ad9d7dc4';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-08-23 09:03:38';
public const RELEASE_DATE = '2024-08-23 09:58:02';
/**
* @var int
*/
Expand Down

0 comments on commit 85974b8

Please sign in to comment.