-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add factory methods to create an enum bit mask #31
Add factory methods to create an enum bit mask #31
Conversation
gisostallenberg
commented
Jun 11, 2024
•
edited
Loading
edited
- Add a method to create a bit mask using one or multiple cases
- Add a method to create a bit mask using all cases
- Add a method to create a bit mask with no flags on
- Add a method to create a bit mask without some flags
dec92c8
to
7218417
Compare
* Add a method to create a bit mask using one or multiple cases * Add a method to create a bit mask using all cases * Add a method to create a bit mask with no flags on * Add a method to create a bit mask without some flags
7218417
to
35d40b2
Compare
Looks ok to me. Also, psalm have a several errors. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 35 41 +6
===========================================
Files 3 3
Lines 77 88 +11
===========================================
+ Hits 77 88 +11 |
In addition, |
@yaroslavche One of the points of a factory method is that it provides a clean and clear interface, so I'm very much for adding After you added ba147a6, I'm not really sure what I can do to make this accepted. There is a reason to add |
@gisostallenberg In general, I agree with you. That makes sense. I've just waited for your opinion on that (sorry, that didn't tag you). Regarding the use of I will update the DocBlocks to make @throws consistent with others, add documentation to the README, and then merge the changes and make a new release. Thank you for your contribution. |
You are right in the aspects of static methods not returning I only added the docblock for Thanks for merging! Will you release a new version? |
yes, I've already added a new release: v3.0.2
My reasoning behind this change is as follows: With this PR, the final class now includes static factory methods that consistently return a new object of the class, which aligns with the expected behavior of factory methods. Conversely, when a non-static method returns self (and not a cloned instance), it indicates that the method operates on and returns the same object instance that invoked it. |
Thanks!!
Sure. I agree. Besides that one can use the Thank you so much for your time spend on this PR 🙏🏽 . |
Thank you for your efforts! Really appreciate it <3 |