Skip to content

Commit 79483ad

Browse files
authored
Merge branch 'main' into main
2 parents 7a45775 + 1381c88 commit 79483ad

File tree

5 files changed

+41
-15
lines changed

5 files changed

+41
-15
lines changed

docs/rector_rules_overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 87 Rules Overview
1+
# 88 Rules Overview
22

33
## AbortIfRector
44

src/Rector/ClassMethod/MakeModelAttributesAndScopesProtectedRector.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PHPStan\Reflection\ClassReflection;
1111
use PHPStan\Type\ObjectType;
1212
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
13-
use Rector\Php81\NodeManipulator\AttributeGroupNewLiner;
1413
use Rector\PHPStan\ScopeFetcher;
1514
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
1615
use RectorLaravel\AbstractRector;
@@ -24,8 +23,7 @@ class MakeModelAttributesAndScopesProtectedRector extends AbstractRector
2423
{
2524
public function __construct(
2625
private readonly VisibilityManipulator $visibilityManipulator,
27-
private readonly PhpAttributeAnalyzer $phpAttributeAnalyzer,
28-
private readonly AttributeGroupNewLiner $attributeGroupNewLiner,
26+
private readonly PhpAttributeAnalyzer $phpAttributeAnalyzer
2927
) {}
3028

3129
public function getRuleDefinition(): RuleDefinition
@@ -90,10 +88,6 @@ public function refactor(Node $node): ?Node
9088

9189
$this->visibilityManipulator->makeProtected($node);
9290

93-
if ($node->attrGroups !== []) {
94-
$this->attributeGroupNewLiner->newLine($this->file, $node);
95-
}
96-
9791
return $node;
9892
}
9993

src/Rector/Expr/AppEnvironmentComparisonToParameterRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function handleBinaryOp(BinaryOp $binaryOp): array
113113
$methodCall = array_values(
114114
array_filter(
115115
[$binaryOp->left, $binaryOp->right],
116-
fn ($node) => $this->validMethodCall($node),
116+
$this->validMethodCall(...),
117117
)
118118
)[0] ?? null;
119119

src/Rector/StaticCall/DispatchToHelperFunctionsRector.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace RectorLaravel\Rector\StaticCall;
44

55
use PhpParser\Node;
6-
use PhpParser\Node\Arg;
76
use PhpParser\Node\Expr\FuncCall;
87
use PhpParser\Node\Expr\New_;
98
use PhpParser\Node\Expr\StaticCall;
@@ -137,11 +136,13 @@ private function createDispatchableCall(StaticCall $staticCall, string $method):
137136
return null;
138137
}
139138

140-
return new FuncCall(
141-
new Name($method),
142-
[
143-
new Arg(new New_(new FullyQualified($class), $staticCall->args)),
144-
],
139+
$className = $class->isSpecialClassName()
140+
? $class
141+
: new FullyQualified($class);
142+
143+
return $this->nodeFactory->createFuncCall(
144+
$method,
145+
[new New_($className, $staticCall->args)],
145146
);
146147
}
147148
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace RectorLaravel\Tests\Rector\StaticCall\DispatchToHelperFunctionsRector\Fixture;
4+
5+
use Illuminate\Foundation\Bus\Dispatchable;
6+
7+
class BusDispatchableWithinSelf
8+
{
9+
use Dispatchable;
10+
11+
public function handle()
12+
{
13+
self::dispatch();
14+
}
15+
}
16+
-----
17+
<?php
18+
19+
namespace RectorLaravel\Tests\Rector\StaticCall\DispatchToHelperFunctionsRector\Fixture;
20+
21+
use Illuminate\Foundation\Bus\Dispatchable;
22+
23+
class BusDispatchableWithinSelf
24+
{
25+
use Dispatchable;
26+
27+
public function handle()
28+
{
29+
dispatch(new self());
30+
}
31+
}

0 commit comments

Comments
 (0)