-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle crash parent default empty array/string param on AddPa…
…ramBasedOnParentClassMethodRector (#4833) * [Php80] Handle crash parent default array param on AddParamBasedOnParentClassMethodRector * [Php80] Handle crash parent default array param on AddParamBasedOnParentClassMethodRector * Fixed 🎉 * Fixed 🎉 * Fixed 🎉 * Fixed 🎉 * ensure reprint * test for non empty array and non empty stirng * Really final touch: fixture rename * add failing test crash on default int * default int or float * [ci-review] Rector Rectify * float param fixture * float param fix * float param fixture * final touch: handle empty string double quote * Final touch: clean up fixture * Really really final touch: fixture long array empty --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
4163578
commit 4b34887
Showing
5 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...mBasedOnParentClassMethodRector/Fixture/extends_parent_default_empty_array_string.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\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultEmptyArrayString extends ParentWithParamWithDefaultValue { | ||
public function emptyArray() { | ||
} | ||
|
||
public function emptyArray2() { | ||
} | ||
|
||
public function emptyString() { | ||
} | ||
|
||
public function emptyString2() { | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultEmptyArrayString extends ParentWithParamWithDefaultValue { | ||
public function emptyArray($default = []) { | ||
} | ||
|
||
public function emptyArray2($default = array()) { | ||
} | ||
|
||
public function emptyString($default = '') { | ||
} | ||
|
||
public function emptyString2($default = '') { | ||
} | ||
} | ||
|
||
?> |
31 changes: 31 additions & 0 deletions
31
...sMethod/AddParamBasedOnParentClassMethodRector/Fixture/extends_parent_default_int.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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultIntOrFloat extends ParentWithParamWithDefaultValue { | ||
public function intParam() { | ||
} | ||
|
||
public function floatParam() { | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultIntOrFloat extends ParentWithParamWithDefaultValue { | ||
public function intParam($default = 123) { | ||
} | ||
|
||
public function floatParam($default = 1.23) { | ||
} | ||
} | ||
|
||
?> |
31 changes: 31 additions & 0 deletions
31
...edOnParentClassMethodRector/Fixture/extends_parent_default_non_empty_array_string.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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultEmptyArrayString extends ParentWithParamWithDefaultValue { | ||
public function nonEmptyArray() { | ||
} | ||
|
||
public function nonEmptyString() { | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector\Source\ParentWithParamWithDefaultValue; | ||
|
||
class ExtendsParentDefaultEmptyArrayString extends ParentWithParamWithDefaultValue { | ||
public function nonEmptyArray($default = ['some data']) { | ||
} | ||
|
||
public function nonEmptyString($default = 'some value') { | ||
} | ||
} | ||
|
||
?> |
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