-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Handle in inner function on ReturnTypeFromStrictTer…
…naryRector (#5785)
- Loading branch information
1 parent
4c40eb6
commit d869306
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...aration/Rector/Class_/ReturnTypeFromStrictTernaryRector/Fixture/in_inner_function.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,37 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\ReturnTypeFromStrictTernaryRector\Fixture; | ||
|
||
final class InInnerFunction | ||
{ | ||
public function getValue($number) | ||
{ | ||
function foo($number) | ||
{ | ||
return $number ? 100 : 500; | ||
} | ||
|
||
echo foo($number); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\ReturnTypeFromStrictTernaryRector\Fixture; | ||
|
||
final class InInnerFunction | ||
{ | ||
public function getValue($number) | ||
{ | ||
function foo($number): int | ||
{ | ||
return $number ? 100 : 500; | ||
} | ||
|
||
echo foo($number); | ||
} | ||
} | ||
|
||
?> |
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