-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Transform] Handle property exists via Property Promotion on NewToMet…
…hodCallRector (#1915)
- Loading branch information
1 parent
72710eb
commit 7330674
Showing
3 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.../Rector/New_/NewToMethodCallRector/Fixture/property_exists_via_property_promotion.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,37 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Fixture; | ||
|
||
use Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Source\MyClass; | ||
|
||
final class PropertyExistsViaPropertyPromotion | ||
{ | ||
public function __construct(private \Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Source\MyClassFactory $mySomeFactory) | ||
{ | ||
} | ||
public function default() | ||
{ | ||
new MyClass('abcd'); | ||
$class = new MyClass('abcd'); | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Fixture; | ||
|
||
use Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Source\MyClass; | ||
|
||
final class PropertyExistsViaPropertyPromotion | ||
{ | ||
public function __construct(private \Rector\Tests\Transform\Rector\New_\NewToMethodCallRector\Source\MyClassFactory $mySomeFactory) | ||
{ | ||
} | ||
public function default() | ||
{ | ||
$this->mySomeFactory->create('abcd'); | ||
$class = $this->mySomeFactory->create('abcd'); | ||
} | ||
} | ||
?> |
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
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