Skip to content

Commit

Permalink
[CodingStyle] Remove custom code rule ManualJsonStringToJsonEncodeArr…
Browse files Browse the repository at this point in the history
…ayRector, not much generic (#1398)

* [CodingStyle] Remove custom code rule ManualJsonStringToJsonEncodeArrayRector, not much generic

* remove rule from doc
  • Loading branch information
TomasVotruba committed Dec 5, 2021
1 parent f99d879 commit 29562a6
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 1,127 deletions.
29 changes: 2 additions & 27 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 504 Rules Overview
# 503 Rules Overview

<br>

Expand All @@ -12,7 +12,7 @@

- [CodeQuality](#codequality) (70)

- [CodingStyle](#codingstyle) (37)
- [CodingStyle](#codingstyle) (36)

- [Compatibility](#compatibility) (1)

Expand Down Expand Up @@ -2130,31 +2130,6 @@ Make method visibility same as parent one

<br>

### ManualJsonStringToJsonEncodeArrayRector

Convert manual JSON string to JSON::encode array

- class: [`Rector\CodingStyle\Rector\Assign\ManualJsonStringToJsonEncodeArrayRector`](../rules/CodingStyle/Rector/Assign/ManualJsonStringToJsonEncodeArrayRector.php)

```diff
+use Nette\Utils\Json;
+
final class SomeClass
{
public function run()
{
- $someJsonAsString = '{"role_name":"admin","numberz":{"id":"10"}}';
+ $data = [
+ 'role_name' => 'admin',
+ 'numberz' => ['id' => 10]
+ ];
+ $someJsonAsString = Json::encode($data);
}
}
```

<br>

### NewlineAfterStatementRector

Add new line after statements to tidify code
Expand Down
2 changes: 0 additions & 2 deletions config/set/coding-style.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use Rector\CodingStyle\Rector\Assign\ManualJsonStringToJsonEncodeArrayRector;
use Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
Expand Down Expand Up @@ -55,7 +54,6 @@
$services->set(EncapsedStringsToSprintfRector::class);
$services->set(WrapEncapsedVariableInCurlyBracesRector::class);
$services->set(NewlineBeforeNewAssignSetRector::class);
$services->set(ManualJsonStringToJsonEncodeArrayRector::class);
$services->set(AddArrayDefaultToArrayPropertyRector::class);
$services->set(AddFalseDefaultToBoolPropertyRector::class);
$services->set(MakeInheritedMethodVisibilitySameAsParentRector::class);
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ parameters:
paths:
- packages/NodeNestingScope/FlowOfControlLocator.php
- rules/CodeQuality/Rector/Return_/SimplifyUselessVariableRector.php
- rules/CodingStyle/Rector/Assign/ManualJsonStringToJsonEncodeArrayRector.php
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
- src/Application/FileProcessor.php
- src/PhpParser/Node/BetterNodeFinder.php
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 29562a6

Please sign in to comment.