-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Using ClassMethodReturnTypeOverrideGuard on ReturnT…
…ypeFromStrictParamRector (#4878) * [TypeDeclaration] Using ClassMethodReturnTypeOverrideGuard on ReturnTypeFromStrictParamRector * tweak of parent not found * Fix * add parent already has return on ReturnTypeFromStrictParamRector * fixture fix
- Loading branch information
1 parent
ea2252a
commit 6424bae
Showing
7 changed files
with
67 additions
and
28 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
13 changes: 13 additions & 0 deletions
13
...Rector/ClassMethod/ReturnTypeFromStrictParamRector/Fixture/from_parent_has_return.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,13 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Source\ParentHasReturn; | ||
|
||
class FromParentHasReturn extends ParentHasReturn { | ||
public function doFoo(int $param): int { | ||
return $param; | ||
} | ||
} | ||
|
||
?> |
27 changes: 27 additions & 0 deletions
27
...tion/Rector/ClassMethod/ReturnTypeFromStrictParamRector/Fixture/parent_overridden.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,27 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Source\ParentOverrideBase; | ||
|
||
class ParentOverridden extends ParentOverrideBase { | ||
public function doFoo(ParentOverrideBase $param) { | ||
return $param; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Source\ParentOverrideBase; | ||
|
||
class ParentOverridden extends ParentOverrideBase { | ||
public function doFoo(ParentOverrideBase $param): ParentOverrideBase { | ||
return $param; | ||
} | ||
} | ||
|
||
?> |
15 changes: 0 additions & 15 deletions
15
...Rector/ClassMethod/ReturnTypeFromStrictParamRector/Fixture/skip_parent_overridden.php.inc
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
...Declaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector/Source/ParentHasReturn.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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Source; | ||
|
||
class ParentHasReturn { | ||
public function doFoo(int $param): int { | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...laration/Rector/ClassMethod/ReturnTypeFromStrictParamRector/Source/ParentOverrideBase.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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector\Source; | ||
|
||
class ParentOverrideBase { | ||
public function doFoo(ParentOverrideBase $param) { | ||
} | ||
} |
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