Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Skip direct InlineHTML on CompleteMissingIfElseBracketR…
…ector (#5125) * [CodeQuality] Skip direct InlineHTML on CompleteMissingIfElseBracketRector * Fixed 🎉 * [ci-review] Rector Rectify * more example * check end statement early * Fixed 🎉 * more test * [ci-review] Rector Rectify * rename method --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
96a1476
commit cd0881e
Showing
3 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...s/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector/Fixture/echo_after_if.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="test <?php if (rand(0,1)) echo 'hidden'; ?>"></div> | ||
----- | ||
<div class="test <?php if (rand(0,1)) { | ||
echo 'hidden'; | ||
} ?>"></div> |
35 changes: 35 additions & 0 deletions
35
...odeQuality/Rector/If_/CompleteMissingIfElseBracketRector/Fixture/skip_direct_html.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector\Fixture; | ||
|
||
class SkipDirectHTML | ||
{ | ||
public function run($value) | ||
{ | ||
if ($value) ?> | ||
<div>Hello</div> | ||
<?php | ||
} | ||
|
||
public function run2($value) | ||
{ | ||
if ($value) { | ||
|
||
} elseif (rand(0, 1)) ?> | ||
|
||
<div>Hello</div> | ||
|
||
<?php | ||
} | ||
|
||
public function run3($value) | ||
{ | ||
if ($value) { | ||
|
||
} else ?> | ||
|
||
<div>Hello</div> | ||
|
||
<?php | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters