-
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
Tweak comment in DecimalValue::newFromArray #108
Conversation
Using DataValueDeserializer is one alternative to this method.
I like it! Stated that way it is less confusing (as using DataValueDeserializer is not given as the only option), which I was complaining about in #106. |
src/DataValues/DecimalValue.php
Outdated
@@ -355,10 +355,11 @@ public function getArrayValue() { | |||
* | |||
* @deprecated since 0.8.3. Static DataValue::newFromArray constructors like this are | |||
* underspecified (not in the DataValue interface), and misleadingly named (should be named | |||
* newFromArrayValue). Instead, use DataValue builder callbacks in @see DataValueDeserializer. | |||
* newFromArrayValue). Instead, use the constructor or use DataValue builder | |||
* callbacks. (e.g. @see DataValueDeserializer) |
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 find the "or" problematic because the possibility to pass callbacks to DataValueDeserializer is not an alternative for having constructors. The callback must still construct a DataValue object, and needs to call a constructor to do this. Also I find the typography (brackets outside of the sentence) weird.
Instead, use the default constructor or introduce a new static constructor with a better name, e.g. when needed for @see DataValueDeserializer.
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.
Also I find the typography (brackets outside of the sentence) weird.
Oh, come on. Just move the full stop to the end:
Instead, use the constructor or use DataValue builder callbacks (e.g. @see DataValueDeserializer).
What I find better in the version @filbertkm is that it is more generic. What you suggest instead is:
- assuming one must use some static constructor in those deserializer callbacks. Maybe it is true in the end. But far too detailed for this particular place IMO.
- IMO saying "introduce a new X but call it Y when you need it" is a bit odd thing to say in the deprecation notice about removing "X".
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.
Use of DataValueDeserializers (builders) is one alternative to this deprecated method but this component can be used on it's own. The alternative w/o use of separate component is just construct the object directly
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.
move the full stop to the end […]
Sure, that's what I'm asking for. Why do I get a "come on" for requesting this?
assuming one must use some static constructor in those deserializer callbacks.
I don't get where I'm saying this. What I say is "Instead, use the default constructor or […]". There is an or. In most cases the default constructor will be enough.
saying "introduce a new X […] in the deprecation notice about removing "X".
I don't get where I say this either. Again: a static constructor might be convenient, but it should not be called "newFromArray". Reasons for this are explained extensively in #106.
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.
Okay, added commit moving the period to the end of the sentence. Here is my review for this pull request:
I really do not intend to spend days on crafting the best depreciation comment message ever. But as the new comment was suggested, and it is in my opinion better than the one there is now, I think it is good to change it. My take on this PR would be that either:
|
I don't like to repeat myself, but it appears what I said was not heard: Stating "use the constructor or use DataValue builder callbacks" sounds like callbacks can act as replacements for constructors, which is not possible. Please tell me what's wrong with |
Okay, as you asked.
To me the second part of this sentence ("introduce a new static constructor with a better name, e.g. when needed") seems a really surprising thing to be said in the depreciation notice. Isn't what you're saying (in the second part, I know you mention the regular constructor in the first part) basically: "Don't use this. Instead introduce something new if you need. Just give it a good name"? Reading it now, I would not have called __construct "default constructor" either. This is the only constructor exists in PHP, isn't it? But this is a minor detail. |
"Static constructor methods", short "static constructors". "Default constructor" seems to be much more ambiguous, but what else is
Yes, that's it. It appears you think there is something wrong with this, but I don't get it. |
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 simplified the comment a lot, because the class in question here really does not need a more convenient way to be constructed. If this is fine for you I will update similar comments in other classes.
+1 |
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.
The migration path away from newFromArray is DataValueDeserializer, so removing the mention of it is not good.
Using DataValueDeserializer is one alternative to this method.