Skip to content

Commit 4fb2a68

Browse files
[CodeQuality] Skip with HTML on CompleteMissingIfElseBracketRector (#7952)
* [CodeQuality] Skip with HTML on CompleteMissingIfElseBracketRector * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
1 parent b1899f4 commit 4fb2a68

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

rules-tests/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector/Fixture/echo_after_if.php.inc

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
# its a .phtml file
3+
?>
4+
<tr<?php if (!$this->some()) echo ' class="border"' ?>>
5+
<td></td>
6+
</tr>

rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PhpParser\Node\Stmt\ElseIf_;
1111
use PhpParser\Node\Stmt\If_;
1212
use PhpParser\Token;
13+
use Rector\Contract\Rector\HTMLAverseRectorInterface;
1314
use Rector\NodeTypeResolver\Node\AttributeKey;
1415
use Rector\Rector\AbstractRector;
1516
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -18,7 +19,7 @@
1819
/**
1920
* @see \Rector\Tests\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector\CompleteMissingIfElseBracketRectorTest
2021
*/
21-
final class CompleteMissingIfElseBracketRector extends AbstractRector
22+
final class CompleteMissingIfElseBracketRector extends AbstractRector implements HTMLAverseRectorInterface
2223
{
2324
public function getRuleDefinition(): RuleDefinition
2425
{

rules/Php86/Rector/FuncCall/MinMaxToClampRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Rector\Php86\Rector\FuncCall;
66

7+
use PhpParser\Node\Identifier;
78
use PhpParser\Node;
89
use PhpParser\Node\Arg;
910
use PhpParser\Node\Expr;
@@ -129,7 +130,7 @@ private function createClampFuncCall(
129130

130131
private function isSupportedArg(Arg $arg): bool
131132
{
132-
return ! $arg->unpack && $arg->name === null;
133+
return ! $arg->unpack && !$arg->name instanceof Identifier;
133134
}
134135

135136
/**

src/Rector/AbstractRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ protected function getType(Node $node): Type
224224
/**
225225
* Use this method for getting native expr type
226226
*/
227-
protected function getNativeType(Expr $node): Type
227+
protected function getNativeType(Expr $expr): Type
228228
{
229-
return $this->nodeTypeResolver->getNativeType($node);
229+
return $this->nodeTypeResolver->getNativeType($expr);
230230
}
231231

232232
/**

0 commit comments

Comments
 (0)