-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Add return self object support on ReturnTypeFromStr…
…ictFluentReturnRector (#4915)
- Loading branch information
1 parent
093bcb6
commit 6d009cc
Showing
2 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ion/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector/Fixture/return_self.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\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector\Fixture; | ||
|
||
final class ReturnSelf | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test() | ||
{ | ||
$obj = new self(); | ||
$obj->foo = 'foo'; | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector\Fixture; | ||
|
||
final class ReturnSelf | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test(): self | ||
{ | ||
$obj = new self(); | ||
$obj->foo = 'foo'; | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
?> |
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