diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index 11ed7dbf..a60ee127 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 75 Rules Overview +# 76 Rules Overview ## AbortIfRector @@ -333,6 +333,24 @@ Replace `(new \Illuminate\Testing\TestResponse)->assertStatus(200)` with `(new \
+## AvoidNegatedCollectionContainsOrDoesntContainRector + +Convert negated calls to `contains` to `doesntContain`, or vice versa. + +- class: [`RectorLaravel\Rector\BooleanNot\AvoidNegatedCollectionContainsOrDoesntContainRector`](../src/Rector/BooleanNot/AvoidNegatedCollectionContainsOrDoesntContainRector.php) + +```diff + use Illuminate\Support\Collection; + + $collection = new Collection([0, 1, null, -1]); +-! $collection->contains(fn (?int $number): bool => is_null($number)); +-! $collection->doesntContain(fn (?int $number) => $number > 0); ++$collection->doesntContain(fn (?int $number): bool => is_null($number)); ++$collection->contains(fn (?int $number) => $number > 0); +``` + +
+ ## AvoidNegatedCollectionFilterOrRejectRector Avoid negated conditionals in `filter()` by using `reject()`, or vice versa.