Skip to content
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
59 changes: 4 additions & 55 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 418 Rules Overview
# 417 Rules Overview

<br>

Expand Down Expand Up @@ -62,7 +62,7 @@

- [Strict](#strict) (6)

- [Transform](#transform) (34)
- [Transform](#transform) (33)

- [TypeDeclaration](#typedeclaration) (40)

Expand Down Expand Up @@ -4041,12 +4041,12 @@ Return early prepared value in ifs
{
- $var = null;
-
if (rand(0,1)) {
if (rand(0, 1)) {
- $var = 1;
+ return 1;
}

if (rand(0,1)) {
if (rand(0, 1)) {
- $var = 2;
+ return 2;
}
Expand Down Expand Up @@ -7865,57 +7865,6 @@ return static function (RectorConfig $rectorConfig): void {

<br>

### ArgumentFuncCallToMethodCallRector

Move help facade-like function calls to constructor injection

:wrench: **configure it!**

- class: [`Rector\Transform\Rector\FuncCall\ArgumentFuncCallToMethodCallRector`](../rules/Transform/Rector/FuncCall/ArgumentFuncCallToMethodCallRector.php)

```php
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\FuncCall\ArgumentFuncCallToMethodCallRector;
use Rector\Transform\ValueObject\ArgumentFuncCallToMethodCall;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(ArgumentFuncCallToMethodCallRector::class, [
new ArgumentFuncCallToMethodCall('view', 'Illuminate\Contracts\View\Factory', 'make'),
]);
};
```


```diff
class SomeController
{
+ /**
+ * @var \Illuminate\Contracts\View\Factory
+ */
+ private $viewFactory;
+
+ public function __construct(\Illuminate\Contracts\View\Factory $viewFactory)
+ {
+ $this->viewFactory = $viewFactory;
+ }
+
public function action()
{
- $template = view('template.blade');
- $viewFactory = view();
+ $template = $this->viewFactory->make('template.blade');
+ $viewFactory = $this->viewFactory;
}
}
```

<br>

### AttributeKeyToClassConstFetchRector

Replace key value on specific attribute to class constant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory;
use Rector\Testing\PHPUnit\AbstractTestCase;
use Rector\Tests\Transform\Rector\FuncCall\ArgumentFuncCallToMethodCallRector\Fixture\Route;

final class PhpAttributeGroupFactoryTest extends AbstractTestCase
{
Expand Down Expand Up @@ -39,7 +38,7 @@ public function testCreateArgsFromItems(): void
$args = $this->phpAttributeGroupFactory->createArgsFromItems([
new ArrayItemNode('/path', 'path'),
new ArrayItemNode('action', 'name'),
], Route::class);
], 'SomeClass');

$this->assertCount(2, $args);
$this->assertContainsOnlyInstancesOf(Arg::class, $args);
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.

Loading