-
-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaratoin] Skip type if changed (#6261)
- Loading branch information
1 parent
ca4d1fb
commit 60da899
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...or/Param/ParamTypeFromStrictTypedPropertyRector/Fixture/changed_after_assign_type.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 | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\Fixture; | ||
|
||
final class ChangedAfterAssignType | ||
{ | ||
private array $kind; | ||
|
||
public function setAge($kind) | ||
{ | ||
$this->kind = $kind; | ||
|
||
if (!is_array($kind)) { | ||
$kind = [$kind]; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\Fixture; | ||
|
||
final class ChangedAfterAssignType | ||
{ | ||
private array $kind; | ||
|
||
public function setAge(array $kind) | ||
{ | ||
$this->kind = $kind; | ||
|
||
if (!is_array($kind)) { | ||
$kind = [$kind]; | ||
} | ||
} | ||
} | ||
|
||
?> |
17 changes: 17 additions & 0 deletions
17
...ion/Rector/Param/ParamTypeFromStrictTypedPropertyRector/Fixture/skip_changed_type.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,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\Fixture; | ||
|
||
final class SkipChangedType | ||
{ | ||
private array $kind; | ||
|
||
public function setAge($kind) | ||
{ | ||
if (!is_array($kind)) { | ||
$kind = [$kind]; | ||
} | ||
|
||
$this->kind = $kind; | ||
} | ||
} |
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