-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: NewlineBeforeNewAssignSetRector variable as same name like prope…
…rty (#6705) * fix: NewlineBeforeNewAssignSetRector variable as same name like property * Add fixture * Fix class name * Remove override * fix: add some tests with current object
- Loading branch information
1 parent
756c244
commit c781983
Showing
4 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...ts/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector/Fixture/objects.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,38 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Objects | ||
{ | ||
private ?Value $foo = null; | ||
private ?Value $bar = null; | ||
public function run() | ||
{ | ||
$this->foo = new Value; | ||
$this->foo->bar = 1; | ||
$this->bar = new Value; | ||
$this->bar->bar = 1; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Objects | ||
{ | ||
private ?Value $foo = null; | ||
private ?Value $bar = null; | ||
public function run() | ||
{ | ||
$this->foo = new Value; | ||
$this->foo->bar = 1; | ||
|
||
$this->bar = new Value; | ||
$this->bar->bar = 1; | ||
} | ||
} | ||
|
||
?> |
36 changes: 36 additions & 0 deletions
36
...CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector/Fixture/properties.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,36 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Properties | ||
{ | ||
public function run() | ||
{ | ||
$foo = new Value; | ||
$foo->bar = new Value; | ||
$foo->bar->bar = 5; | ||
$bar = new Value; | ||
$bar->foo = 1; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Properties | ||
{ | ||
public function run() | ||
{ | ||
$foo = new Value; | ||
$foo->bar = new Value; | ||
$foo->bar->bar = 5; | ||
|
||
$bar = new Value; | ||
$bar->foo = 1; | ||
} | ||
} | ||
|
||
?> |
38 changes: 38 additions & 0 deletions
38
...ts/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector/Fixture/statics.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,38 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Statics | ||
{ | ||
protected static ?Value $fooBar = null; | ||
protected static ?Value $barFoo = null; | ||
public function run() | ||
{ | ||
self::$fooBar = new Value; | ||
self::$fooBar->bar = 1; | ||
self::$barFoo = new Value; | ||
self::$barFoo->bar = 1; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector\Fixture; | ||
|
||
final class Statics | ||
{ | ||
protected static ?Value $fooBar = null; | ||
protected static ?Value $barFoo = null; | ||
public function run() | ||
{ | ||
self::$fooBar = new Value; | ||
self::$fooBar->bar = 1; | ||
|
||
self::$barFoo = new Value; | ||
self::$barFoo->bar = 1; | ||
} | ||
} | ||
|
||
?> |
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