From 915565b3676f08b64d9356e5925ee0067c2c8ce4 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Thu, 9 Jan 2025 19:28:43 +0000 Subject: [PATCH] Update docs (#289) --- docs/rector_rules_overview.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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.