Skip to content

Commit

Permalink
[TypeDeclaration] Remove unused intersection docblock on nullable int…
Browse files Browse the repository at this point in the history
…ersection on TypedPropertyFromAssignsRector (#3373)
  • Loading branch information
samsonasik authored Feb 12, 2023
1 parent db4ec02 commit 91ddd68
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ use PHPUnit\Framework\TestCase;

class NullableIntersectionType extends TestCase
{
/**
* @var DateTime&MockObject
*/
private (\DateTime&\PHPUnit\Framework\MockObject\MockObject)|null $property = null;

public function testExample(): void
Expand Down
3 changes: 1 addition & 2 deletions rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\UnionType;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
use Rector\StaticTypeMapper\StaticTypeMapper;
Expand All @@ -29,7 +28,7 @@ public function isDead(VarTagValueNode $varTagValueNode, Property $property): bo
$propertyType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($property->type);
$docType = $this->staticTypeMapper->mapPHPStanPhpDocTypeNodeToPHPStanType($varTagValueNode->type, $property);

if ($propertyType instanceof UnionType && ! $docType instanceof UnionType && ! $docType instanceof IntersectionType) {
if ($propertyType instanceof UnionType && ! $docType instanceof UnionType) {
return true;
}

Expand Down

0 comments on commit 91ddd68

Please sign in to comment.