Skip to content
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

SA: Update operations. #165

Merged
merged 5 commits into from
Jul 31, 2021
Merged

Conversation

drupol
Copy link
Collaborator

@drupol drupol commented Jul 30, 2021

This PR:

@drupol drupol force-pushed the refactor/update-static-type-informations branch from 91ded3e to 388b5f2 Compare July 31, 2021 08:30
@drupol drupol force-pushed the refactor/update-static-type-informations branch from 388b5f2 to 74c701d Compare July 31, 2021 08:35
@AlexandruGG
Copy link
Collaborator

@drupol hey, indeed this looks like an issue with Psalm. Could you reproduce it at https://psalm.dev/ so we can also compare with PHPStan and open an issue?

@drupol
Copy link
Collaborator Author

drupol commented Jul 31, 2021

@drupol hey, indeed this looks like an issue with Psalm. Could you reproduce it at https://psalm.dev/ so we can also compare with PHPStan and open an issue?

No, I haven't had the time to do it yet, I will most probably focus on this in the evening.

@drupol
Copy link
Collaborator Author

drupol commented Jul 31, 2021

@AlexandruGG I think it's a false positive. Actually Psalm was right, the $concat callback has a nullable $carry parameter, I didn't expected that.

Could you please let me know if it's ok for you?

@drupol drupol marked this pull request as ready for review July 31, 2021 17:05
@drupol drupol enabled auto-merge (squash) July 31, 2021 17:05
@drupol drupol requested a review from AlexandruGG July 31, 2021 17:05
@drupol drupol added the enhancement New feature or request label Jul 31, 2021
@AlexandruGG
Copy link
Collaborator

@AlexandruGG I think it's a false positive. Actually Psalm was right, the $concat callback has a nullable $carry parameter, I didn't expected that.

Could you please let me know if it's ok for you?

Yep you're right!

Comparing to Reduce, the scans will always add the initial parameter passed in, which has a default null. Which means if the Collection is empty then you will be left with a Collection<int, null>. Whereas with Reduce you always get the type returned by the callback, and if the collection is empty it will continue to be empty

@drupol drupol merged commit 0175278 into master Jul 31, 2021
@drupol drupol deleted the refactor/update-static-type-informations branch July 31, 2021 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants