Skip to content

Commit

Permalink
[DX] Remove *AnnotationIncorrectNullableRector rules as works with un…
Browse files Browse the repository at this point in the history
…reliable docblocks and can have 2 solutions (#4719)
  • Loading branch information
TomasVotruba authored Aug 8, 2023
1 parent b00b694 commit 3de7c69
Show file tree
Hide file tree
Showing 75 changed files with 5 additions and 2,479 deletions.
69 changes: 2 additions & 67 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 360 Rules Overview
# 357 Rules Overview

<br>

Expand Down Expand Up @@ -54,7 +54,7 @@

- [Transform](#transform) (22)

- [TypeDeclaration](#typedeclaration) (44)
- [TypeDeclaration](#typedeclaration) (41)

- [Visibility](#visibility) (3)

Expand Down Expand Up @@ -7701,30 +7701,6 @@ Change numeric return type based on strict returns type operations

<br>

### ParamAnnotationIncorrectNullableRector

Add or remove null type from `@param` phpdoc typehint based on php parameter type declaration

- class: [`Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector`](../rules/TypeDeclaration/Rector/ClassMethod/ParamAnnotationIncorrectNullableRector.php)

```diff
final class SomeClass
{
/**
- * @param \DateTime[] $dateTimes
+ * @param \DateTime[]|null $dateTimes
*/
public function setDateTimes(?array $dateTimes): self
{
$this->dateTimes = $dateTimes;

return $this;
}
}
```

<br>

### ParamTypeByMethodCallTypeRector

Change param type based on passed method call type
Expand Down Expand Up @@ -7829,28 +7805,6 @@ Add property type based on strict setter and getter method

<br>

### ReturnAnnotationIncorrectNullableRector

Add or remove null type from `@return` phpdoc typehint based on php return type declaration

- class: [`Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector`](../rules/TypeDeclaration/Rector/ClassMethod/ReturnAnnotationIncorrectNullableRector.php)

```diff
final class SomeClass
{
/**
- * @return \DateTime[]
+ * @return \DateTime[]|null
*/
public function getDateTimes(): ?array
{
return $this->dateTimes;
}
}
```

<br>

### ReturnNeverTypeRector

Add "never" return-type for methods that never return anything
Expand Down Expand Up @@ -8288,25 +8242,6 @@ Add strict typed property based on `setUp()` strict typed assigns in TestCase

<br>

### VarAnnotationIncorrectNullableRector

Add or remove null type from `@var` phpdoc typehint based on php property type declaration

- class: [`Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector`](../rules/TypeDeclaration/Rector/Property/VarAnnotationIncorrectNullableRector.php)

```diff
final class SomeClass
{
/**
- * @var DateTime[]
+ * @var DateTime[]|null
*/
private ?array $dateTimes;
}
```

<br>

### WhileNullableToInstanceofRector

Change while null compare to strict instanceof check
Expand Down
6 changes: 0 additions & 6 deletions config/set/type-declaration.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamAnnotationIncorrectNullableRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnAnnotationIncorrectNullableRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
Expand All @@ -40,16 +38,12 @@
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
use Rector\TypeDeclaration\Rector\Property\VarAnnotationIncorrectNullableRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rules([
AddArrowFunctionReturnTypeRector::class,
ParamTypeByMethodCallTypeRector::class,
TypedPropertyFromAssignsRector::class,
ReturnAnnotationIncorrectNullableRector::class,
VarAnnotationIncorrectNullableRector::class,
ParamAnnotationIncorrectNullableRector::class,
AddReturnTypeDeclarationBasedOnParentClassMethodRector::class,
ReturnTypeFromStrictTypedPropertyRector::class,
TypedPropertyFromStrictConstructorRector::class,
Expand Down
23 changes: 0 additions & 23 deletions packages/PhpDocParser/PhpDocInfoAnalyzer.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3de7c69

Please sign in to comment.