-
-
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.
[Renaming] Rename class method implements interface with method exists (
#1155) Co-authored-by: Wojciech Kania <wojciech.kania@gmail.com> Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
2906122
commit 9d626ea
Showing
13 changed files
with
175 additions
and
19 deletions.
There are no files selected for viewing
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
43 changes: 43 additions & 0 deletions
43
...naming/Rector/MethodCall/RenameMethodRector/Fixture/rename_method_and_method_call.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,43 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
final class CustomType | ||
{ | ||
public function notify(): int | ||
{ | ||
return 5; | ||
} | ||
} | ||
|
||
final class Caller | ||
{ | ||
public static function execute(): void | ||
{ | ||
$demo = new CustomType(); | ||
$demo->notify(); | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
final class CustomType | ||
{ | ||
public function __invoke(): int | ||
{ | ||
return 5; | ||
} | ||
} | ||
|
||
final class Caller | ||
{ | ||
public static function execute(): void | ||
{ | ||
$demo = new CustomType(); | ||
$demo->__invoke(); | ||
} | ||
} | ||
?> |
33 changes: 33 additions & 0 deletions
33
...MethodCall/RenameMethodRector/Fixture/rename_method_call_when_class_method_exists.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,33 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Fixture; | ||
|
||
use Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source\Foo; | ||
|
||
class RenameMethodCall | ||
{ | ||
private function call() | ||
{ | ||
$foo = new Foo(); | ||
$foo->old(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Fixture; | ||
|
||
use Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source\Foo; | ||
|
||
class RenameMethodCall | ||
{ | ||
private function call() | ||
{ | ||
$foo = new Foo(); | ||
$foo->new(); | ||
} | ||
} | ||
|
||
?> |
22 changes: 22 additions & 0 deletions
22
...s-tests/Renaming/Rector/MethodCall/RenameMethodRector/Fixture/skip_when_interface.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,22 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
class SkipRenameMethodCall | ||
{ | ||
public static function execute(): void | ||
{ | ||
$demo = new SomeSubscriber(); | ||
$demo->old(); | ||
} | ||
} | ||
|
||
class SomeSubscriber implements SubscriberInterface | ||
{ | ||
public function old(): int | ||
{ | ||
return 5; | ||
} | ||
} | ||
|
||
?> |
11 changes: 11 additions & 0 deletions
11
rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Source/CustomType.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
final class CustomType | ||
{ | ||
public function notify(): int | ||
{ | ||
return 5; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Source/Foo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
final class Foo implements FooInterface | ||
{ | ||
public function old(): void | ||
{ | ||
} | ||
|
||
public function new(): void | ||
{ | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Source/FooInterface.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
interface FooInterface | ||
{ | ||
public function old(): void; | ||
} |
11 changes: 11 additions & 0 deletions
11
rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Source/SomeSubscriber.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
class SomeSubscriber implements SubscriberInterface | ||
{ | ||
public function old(): int | ||
{ | ||
return 5; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Source/SubscriberInterface.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\Source; | ||
|
||
interface SubscriberInterface | ||
{ | ||
public function old(): int; | ||
} |
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
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