mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
[TypeDeclaration] Register ParamAnnotationIncorrectNullableRector to type-declaration config set (#2071)
* [TypeDeclaration] Register ParamAnnotationIncorrectNullableRector to type-declaration config set * [ci-review] Rector Rectify * clean up unneeded ClassMethodReturnTypeOverrideGuard usage * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
d30a86313f
commit
09499098eb
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
use Rector\Config\RectorConfig;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector;
|
||||
|
@ -28,4 +29,5 @@ return static function (RectorConfig $rectorConfig): void {
|
|||
$services->set(TypedPropertyFromAssignsRector::class);
|
||||
$services->set(ReturnAnnotationIncorrectNullableRector::class);
|
||||
$services->set(VarAnnotationIncorrectNullableRector::class);
|
||||
$services->set(ParamAnnotationIncorrectNullableRector::class);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ final class AnnotationToAttribute
|
|||
{
|
||||
/**
|
||||
* @param class-string|string $tag
|
||||
* @param class-string $attributeClass
|
||||
* @param class-string|null $attributeClass
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $tag,
|
||||
|
|
|
@ -18,7 +18,6 @@ use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
|||
use Rector\TypeDeclaration\Guard\PhpDocNestedAnnotationGuard;
|
||||
use Rector\TypeDeclaration\Helper\PhpDocNullableTypeHelper;
|
||||
use Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory;
|
||||
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
|
@ -31,7 +30,6 @@ final class ParamAnnotationIncorrectNullableRector extends AbstractRector
|
|||
private readonly TypeComparator $typeComparator,
|
||||
private readonly PhpDocNullableTypeHelper $phpDocNullableTypeHelper,
|
||||
private readonly PhpDocNestedAnnotationGuard $phpDocNestedAnnotationGuard,
|
||||
private readonly ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard,
|
||||
private readonly ParamPhpDocNodeFactory $paramPhpDocNodeFactory
|
||||
) {
|
||||
}
|
||||
|
@ -94,10 +92,6 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($node instanceof ClassMethod && $this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($node)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::TYPED_PROPERTIES)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -131,8 +125,7 @@ CODE_SAMPLE
|
|||
Type $newType,
|
||||
Param $param,
|
||||
string $paramName
|
||||
): bool
|
||||
{
|
||||
): bool {
|
||||
// better skip, could crash hard
|
||||
if ($phpDocInfo->hasInvalidTag('@param')) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user