mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
[TypeDeclaration] Skip @inheritdoc on PropertyTypeDeclaration (#1752)
This commit is contained in:
parent
c4b25ec066
commit
7d8444e81b
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector\Fixture;
|
||||
|
||||
final class PrivateWithInheritDoc {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
private $property = 'test';
|
||||
}
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector\Fixture;
|
||||
|
||||
final class PrivateWithInheritDoc {
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @var string
|
||||
*/
|
||||
private $property = 'test';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector\Fixture;
|
||||
|
||||
class SkipTypedInheritDocParent {
|
||||
/** @var string */
|
||||
public $property;
|
||||
}
|
||||
|
||||
final class SkipTypedInheritDoc extends SkipTypedInheritDocParent {
|
||||
/** @inheritDoc */
|
||||
public $property = 'test';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector\Fixture;
|
||||
|
||||
class SkipUntypedInheritDocParent {
|
||||
public $property;
|
||||
}
|
||||
|
||||
final class SkipUntypedInheritDoc extends SkipUntypedInheritDocParent {
|
||||
/** @inheritDoc */
|
||||
public $property = 'test';
|
||||
}
|
||||
?>
|
|
@ -89,6 +89,10 @@ CODE_SAMPLE
|
|||
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
|
||||
if ($phpDocInfo->hasInheritDoc() && ! $node->isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->isVarDocAlreadySet($phpDocInfo)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user