Skip to content

Commit

Permalink
Update docs (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeniJaho authored Oct 17, 2024
1 parent 84edb4a commit da04b05
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
28 changes: 14 additions & 14 deletions docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 68 Rules Overview
# 69 Rules Overview

## AbortIfRector

Expand Down Expand Up @@ -1184,6 +1184,19 @@ Change static `validate()` method to `$request->validate()`

<br>

## ResponseHelperCallToJsonResponseRector

Use new JsonResponse instead of `response()->json()`

- class: [`RectorLaravel\Rector\MethodCall\ResponseHelperCallToJsonResponseRector`](../src/Rector/MethodCall/ResponseHelperCallToJsonResponseRector.php)

```diff
-response()->json(['key' => 'value']);
+return new JsonResponse(['key' => 'value']);
```

<br>

## ReverseConditionableMethodCallRector

Reverse conditionable method calls
Expand Down Expand Up @@ -1362,16 +1375,3 @@ Convert string validation rules into arrays for Laravel's Validator.
```

<br>

## ResponseHelperCallToJsonResponseRector

Change `response()->json()` to `new JsonResponse()`

- class: [`RectorLaravel\Rector\MethodCall\ResponseHelperCallToJsonResponseRector`](../src/Rector/MethodCall/ResponseHelperCallToJsonResponseRector.php)

```diff
- return response()->json(['message' => 'Hello World']);
+ return new \Illuminate\Http\JsonResponse(['message' => 'Hello World']);
```

<br>
6 changes: 4 additions & 2 deletions src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpParser\NodeTraverser;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;

Expand All @@ -29,7 +29,7 @@ public function getRuleDefinition(): RuleDefinition
return new RuleDefinition(
'It will removes the dump data just like dd or dump functions from the code.`',
[
new CodeSample(
new ConfiguredCodeSample(
<<<'CODE_SAMPLE'
class MyController
{
Expand Down Expand Up @@ -61,6 +61,8 @@ public function update()
}
}
CODE_SAMPLE
,
['dd', 'dump'],
),
]
);
Expand Down

0 comments on commit da04b05

Please sign in to comment.