-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AddMethodCallBasedStrictParamTypeRector: Support changing protected m…
…ethods in final classes (#4611) * AddMethodCallBasedStrictParamTypeRector: Support changing protected methods in final classes * Update final_class_without_extends.php.inc * Create skip_final_class_with_extends.php.inc * Update skip_final_class_with_extends.php.inc * Create skip_non_final_class_without_extends.php.inc * fix per review * Support final methods without base-types
- Loading branch information
Showing
6 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...ethod/AddMethodCallBasedStrictParamTypeRector/Fixture/final_class_without_extends.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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class ProtectedMethodInFinalClassWithoutBaseClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
protected function process($data) | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class ProtectedMethodInFinalClassWithoutBaseClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
protected function process(string $data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
39 changes: 39 additions & 0 deletions
39
...thod/AddMethodCallBasedStrictParamTypeRector/Fixture/final_method_without_extends.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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
class FinalProtectedMethodInClassWithoutBaseClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
final protected function process($data) | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
class FinalProtectedMethodInClassWithoutBaseClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
final protected function process(string $data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
19 changes: 19 additions & 0 deletions
19
...hod/AddMethodCallBasedStrictParamTypeRector/Fixture/skip_final_class_with_extends.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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class SkipProtectedMethodInFinalClassWithBaseClass extends SomeClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
protected function process($data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
19 changes: 19 additions & 0 deletions
19
.../AddMethodCallBasedStrictParamTypeRector/Fixture/skip_final_class_with_implements.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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
final class ProtectedMethodInFinalClassImplementingInterface implements SomeUnknownInterface | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
protected function process($data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
19 changes: 19 additions & 0 deletions
19
...MethodCallBasedStrictParamTypeRector/Fixture/skip_non_final_class_without_extends.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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\Fixture; | ||
|
||
class SkipProtectedMethodInNonFinalClassWithoutBaseClass | ||
{ | ||
public function runFirst(string $data) | ||
{ | ||
$this->process($data); | ||
} | ||
|
||
protected function process($data) | ||
{ | ||
} | ||
} | ||
|
||
?> |
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