-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
chore: more specific return type for chunk() method #351
chore: more specific return type for chunk() method #351
Conversation
PR Summary
|
I think there are some new errors to fix. |
5f228d2
to
1da16de
Compare
src/Operation/Chunk.php
Outdated
/** @var non-empty-list<T> $chunk */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this @var
annotation psalm won't be able to infer the fact that chunk is never empty when it is yielded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this didn't help either, because psalm treats T
somewhat awkwardly.
Threrefore, I have somewhat rewritten the implementation into following variant so that both psalm and phpstan are satisfied:
$chunk[] = $value;
if (count($chunk) >= $size) {
++$chunkIndex;
yield $chunk;
$chunk = [];
}
1da16de
to
ce28b5a
Compare
Since this pull request has not had any activity within the last 5 days, I have marked it as stale. |
@drupol , could you help me with this, since right now I'm not sure what I'm expected to do in order to get this PR merged? |
Sorry for the long delay, I'm quite busy with this end of year and I don't have much time left for my open-source projects sadly. Here, it looks like there are code style stuff to update. Are you able to run the tests on your local machine so you can fix them locally and commit/push when it's done? |
It's all right, take your time
I have updated the code so that all checks have passed now. Thank you, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Follows from #350