Skip to content

Commit

Permalink
[TypeDeclaration] Register ReturnAnnotationIncorrectNullableRector an…
Browse files Browse the repository at this point in the history
…d VarAnnotationIncorrectNullableRector to type-declaration config set (#2062)

* [TypeDeclaration] Register ReturnAnnotationIncorrectNullableRector and VarAnnotationIncorrectNullableRector

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
samsonasik and actions-user committed Apr 13, 2022
1 parent 363f408 commit d0c25cc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 4 additions & 0 deletions config/set/type-declaration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;

return static function (RectorConfig $rectorConfig): void {
$services = $rectorConfig->services();
Expand All @@ -24,4 +26,6 @@
$services->set(ParamTypeByParentCallTypeRector::class);
$services->set(ParamTypeByMethodCallTypeRector::class);
$services->set(TypedPropertyFromAssignsRector::class);
$services->set(ReturnAnnotationIncorrectNullableRector::class);
$services->set(VarAnnotationIncorrectNullableRector::class);
};
2 changes: 1 addition & 1 deletion rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private function resolveCount(bool $isNegated, FuncCall $funcCall): Identical |
}

/**
* @return Identical|NotIdentical
* @return Identical|NotIdentical|null
*/
private function resolveArray(bool $isNegated, Expr $expr): ?BinaryOp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ public function refactor(Node $node): Identical | NotIdentical | null
return new NotIdentical($funcCall, $this->nodeFactory->createFalse());
}

/**
* @return FuncCall
*/
private function matchStrContainsOrNotStrContains(FuncCall | BooleanNot $expr): ?FuncCall
{
$expr = ($expr instanceof BooleanNot) ? $expr->expr : $expr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private function refactorStmts(array $stmts): array
}

/**
* @return Name|Identifier
* @return Identifier|Name|null
*/
private function processNameOrIdentifier(Name | Identifier $node): ?Node
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private function shouldSkipFuncCall(FuncCall $funcCall): bool
}

/**
* @return PropertyFetch|MethodCall
* @return MethodCall|PropertyFetch|null
*/
private function refactorFuncCallToMethodCall(
ArgumentFuncCallToMethodCall $argumentFuncCallToMethodCall,
Expand Down

0 comments on commit d0c25cc

Please sign in to comment.