-
-
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 static object support on ReturnTypeFromS…
…trictFluentReturnRector (#4916) * [TypeDeclaration] Add return static object support on ReturnTypeFromStrictFluentReturnRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * clean up * trigger CI --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
6d009cc
commit aa72821
Showing
3 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...n/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector/Fixture/return_static.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; | ||
|
||
class ReturnStatic | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test() | ||
{ | ||
$obj = new static(); | ||
$obj->foo = 'foo'; | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector\Fixture; | ||
|
||
class ReturnStatic | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test(): static | ||
{ | ||
$obj = new static(); | ||
$obj->foo = 'foo'; | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
?> |
37 changes: 37 additions & 0 deletions
37
...Method/ReturnTypeFromStrictFluentReturnRector/FixturePhp74/return_static_on_php74.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\FixturePhp74; | ||
|
||
class ReturnStatic | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test() | ||
{ | ||
$obj = new static(); | ||
$obj->foo = 'foo'; | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector\FixturePhp74; | ||
|
||
class ReturnStatic | ||
{ | ||
private $foo = 'bar'; | ||
|
||
public function test(): self | ||
{ | ||
$obj = new static(); | ||
$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