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

Change NoReturnArrayVariableListRule to ignore array spreads #139

Merged

Conversation

carlos-granados
Copy link
Contributor

Many times we return an array which contains a number of array spreads in order to merge all these arrays and return a single one:

return [...$firstSetOfResults, ...$secondSetOfResults];

The NoReturnArrayVariableListRule sees that we are returning an array composed of two expressions and will return an error asking us to use a value object instead. This is clearly not appropriate for this case

This PR fixes this problem by ignoring array spreads when counting the number of expressions in the returned array

@TomasVotruba
Copy link
Member

Looks good 👍 Thanks

@TomasVotruba TomasVotruba enabled auto-merge (squash) August 22, 2024 13:31
@TomasVotruba TomasVotruba merged commit 58c8dbf into symplify:main Aug 22, 2024
5 of 6 checks passed
@carlos-granados
Copy link
Contributor Author

Thanks! Do you expect to create a release in this repo in the near future? I am trying to decide if we should use this fork or if we should just ignore the error for now and wait for the release

@TomasVotruba
Copy link
Member

Yep, I think next 1-2 weeks tags should land. I'm waiting to collect more fixes/improvement, not to release constantly new versions.

If not, ping me here 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants