-
-
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
Refactor Scalar Operations #132
Conversation
I'm gonna give this one a final look a bit later before marking it ready for review |
Take your time mate, there is no hurry. Do you think it would be possible to add some documentation that explains
I will also use that part in the changelog when doing the release later on. |
Yeah for sure! I was thinking to add a part in the documentation to explain about the operations but I forgot about it there for a moment 😄. Regarding the last bullet point do you want that to be in the documentation or do you mean in the PR description? |
Ok good 👍 I think we can do it in the documentation and I'll copy paste it for the changelog later. |
Sounds good. Btw for BC breaking changes like this should we have a new major version? I.e 5.0? |
I don't know yet. We will see when it's done. |
@@ -76,7 +76,7 @@ This library has been inspired by: | |||
needed are standard PHP variables like `int`, `string`, `callable` or | |||
`iterator`. | |||
It allows users to use those operations individually, at their own will, to | |||
build up something custom. Currently, more than [**80 operations**][28] are | |||
build up something custom. Currently, more than [**100 operations**][28] are |
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.
did a new count and this is up over 100 now 🎉
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.
Excellent :-)
I think it depends if we want this project to follow semver or not. Because based on that any backwards-incompatible API changes should be done as part of a new major version. Also if we do up the version when releasing this we should up the docs version as well. |
@drupol let me know what you think about the documentation update |
docs/pages/api.rst
Outdated
When used as a ``Collection`` method, operations fall into three main categories based on the return type: | ||
|
||
1. Operations that return a ``scalar`` value. Currently, this includes: | ||
``Contains``, ``Every``, ``Falsy``, ``Has``, ``Key``, ``Match`` (or ``MatchOne``), ``Nullsy``, ``Truthy``. |
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.
I think the explanation is overall really great and I wouldn't change a thing, except for the classification points here.
What I propose is to list the operation types as such:
- Operations which returns a boolean: contains, every, falsy, has... etc etc
- Operations which returns a Collection of Collection: span, partition
- Operation which returns an array: all
- Operation which returns a Collection: all the rest.
(be carefull Collection::key() might return anything, not only a scalar, but anything)
Also, what do you think about:
- Updating the signatures of all the operations in the API page and add their return type ?
or - Updating all operations and add a note about the return type ?
(about that page, it's very sad we cannot generate the documentation automatically from the classes themselves!)
Let me know what you think.
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.
@drupol thank you for the feedback, I've done some changes to the numbered list to incorporate your suggestions, with a couple tweaks. Let me know what you think of this new classification :).
Regarding updating the signatures of the operations in the docs -> it's something that I thought about today as well 😄 . I'll do it in a future PR for all of them
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.
Thanks all good now :)
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.
@drupol great, this is all ready on my side 😁
We should definitely follow semver... and therefore it's going to be version 5 indeed. |
Cool in that case I think we can do the |
Thanks, a big one done 🥇 |
This PR refactors Collection Operations which currently return a single scalar value inside a collection, returning the scalar directly.
Related to #107.