Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #262

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading