Skip to content

Commit

Permalink
Update docs (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfox authored Jan 9, 2025
1 parent cf0086c commit 915565b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 75 Rules Overview
# 76 Rules Overview

## AbortIfRector

Expand Down Expand Up @@ -333,6 +333,24 @@ Replace `(new \Illuminate\Testing\TestResponse)->assertStatus(200)` with `(new \

<br>

## 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);
```

<br>

## AvoidNegatedCollectionFilterOrRejectRector

Avoid negated conditionals in `filter()` by using `reject()`, or vice versa.
Expand Down

0 comments on commit 915565b

Please sign in to comment.