-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeDeclaration] Add AddReturnArrayDocblockBasedOnArrayMapRector #6235
Merged
Conversation
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
I actually still working on it similar to it at PR: |
Oh, I see, it on return instead of param ... |
TomasVotruba
force-pushed
the
tv-return-array-filter
branch
from
August 14, 2024 11:41
79f2846
to
0e6cdf7
Compare
@samsonasik Indeed :D I came across different but very similar case, so I'm trying to cover it |
TomasVotruba
force-pushed
the
tv-return-array-filter
branch
from
August 14, 2024 11:59
0e6cdf7
to
343e7b5
Compare
samsonasik
reviewed
Aug 14, 2024
samsonasik
reviewed
Aug 14, 2024
rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Aug 14, 2024
rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php
Show resolved
Hide resolved
samsonasik
reviewed
Aug 14, 2024
rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php
Show resolved
Hide resolved
samsonasik
reviewed
Aug 14, 2024
rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php
Outdated
Show resolved
Hide resolved
TomasVotruba
force-pushed
the
tv-return-array-filter
branch
3 times, most recently
from
August 14, 2024 16:53
09b96ff
to
99c28fd
Compare
new fixture is needed to not change already valid docblock with valid class name from use statement: namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture;
use stdClass;
final class SkipAlreadyValidArrayClassNameReturn
{
/**
* @return stdClass[]
*/
public function process(array $items)
{
return array_map(function ($item): stdClass {
return $item;
}, $items);
}
} |
samsonasik
reviewed
Aug 14, 2024
.../Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector/Fixture/skip_if_else.php.inc
Outdated
Show resolved
Hide resolved
TomasVotruba
force-pushed
the
tv-return-array-filter
branch
2 times, most recently
from
August 14, 2024 17:03
83c47fb
to
e0e4083
Compare
new fixture for union return is needed: namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddReturnArrayDocblockBasedOnArrayMapRector\Fixture;
final class UnionReturnMap
{
+ /**
+ * @return float[]|int[]
+ */
public function run(array $items)
{
if (mt_rand(0, 1)) {
return array_map(function ($item): float {
return $item;
}, $items);
}
return array_map(function ($item): int {
return 1000;
}, $items);
}
}
|
samsonasik
reviewed
Aug 14, 2024
rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php
Outdated
Show resolved
Hide resolved
Done 👍 |
TomasVotruba
force-pushed
the
tv-return-array-filter
branch
from
August 14, 2024 18:22
1d598ea
to
75175ea
Compare
Let's ship this 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.