-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Handle return is_array with conditional parameter insid…
…e on ReturnTypeFromStrictScalarReturnExprRector (#4132) * [CodeQuality] Handle return is_array with conditional parameter inside on ReturnTypeFromStrictScalarReturnExprRector * Fixed 🎉 * [ci-review] Rector Rectify * increase kernel cache key --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
390730a
commit 9889dd4
Showing
5 changed files
with
64 additions
and
16 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
31 changes: 31 additions & 0 deletions
31
...ReturnTypeFromStrictScalarReturnExprRector/Fixture/conditional_type_for_parameter.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\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector\Fixture; | ||
|
||
final class ConditionalTypeForParameter | ||
{ | ||
public function run() | ||
{ | ||
$username = 'xxxxxx'; | ||
$password = 'yyyyyyy'; | ||
return base64_encode(implode(':', [$username, $password])); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector\Fixture; | ||
|
||
final class ConditionalTypeForParameter | ||
{ | ||
public function run(): string | ||
{ | ||
$username = 'xxxxxx'; | ||
$password = 'yyyyyyy'; | ||
return base64_encode(implode(':', [$username, $password])); | ||
} | ||
} | ||
|
||
?> |
27 changes: 27 additions & 0 deletions
27
...or/ClassMethod/ReturnTypeFromStrictScalarReturnExprRector/Fixture/return_is_array.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\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector\Fixture; | ||
|
||
final class ReturnIsArray | ||
{ | ||
public function run($value) | ||
{ | ||
return is_array(ftp_nlist($value, '.')); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector\Fixture; | ||
|
||
final class ReturnIsArray | ||
{ | ||
public function run($value): bool | ||
{ | ||
return is_array(ftp_nlist($value, '.')); | ||
} | ||
} | ||
|
||
?> |
13 changes: 0 additions & 13 deletions
13
...nTypeFromStrictScalarReturnExprRector/Fixture/skip_conditional_type_for_parameter.php.inc
This file was deleted.
Oops, something went wrong.
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