Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[5.5] Add Collection::wrap method #20055
If the given value is not a collection, wrap it in one. This is the collection equivalent to
If you pass a collection or an array as the value you get a collection with data in the collection or array back. If you pass in anything else you get a collection of one containing that value.
Had the idea while reading the code for PR #20053. It could turn 7 LoC (at the end of
No more pesky instanceof check! and it reads rather well too.