Correct descending sort predicate logic and add test for custom predicate.#35
Correct descending sort predicate logic and add test for custom predicate.#35gustavofreze merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa52e1313c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| foreach ($this->elements as $element) { | ||
| if ($first) { | ||
| $result = $element; | ||
| $first = false; |
There was a problem hiding this comment.
Cast first element to string before returning
The new manual join assigns the first element directly to $result and returns it when the iterable has only one element. With declare(strict_types=1), returning a non-string (e.g., Collection::createFrom([1])->joinToString(','), [null], or an object without __toString) will throw a TypeError, whereas the previous implode() behavior always produced a string. Casting the first element to string (or using implode on a built array) would preserve the prior behavior for single-element collections.
Useful? React with 👍 / 👎.
No description provided.