Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] Rename CacheableSupportsMethodInterface to VaryingSupportInterface#27210
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Serializer] Rename CacheableSupportsMethodInterface to VaryingSupportInterface#27210
Uh oh!
There was an error while loading.Please reload this page.
Conversation
teohhanhui commentedMay 9, 2018
/cc@dunglas
|
teohhanhui commentedMay 9, 2018
Travis CI build errored due to network issues... |
| * {@inheritdoc} | ||
| */ | ||
| publicfunctionhasCacheableSupportsMethod():bool | ||
| publicfunctionisSupportsVaryByData():bool |
nicolas-grekasMay 9, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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'm not english-native, but I feel like this should be either "doesSupportsVaryByDataInterface" or "isSupportsVaryingByDataInterface". The context should also be taken into account, so that this could be "doesSupportsVaryByDataOrContextInterface".
All in all, I'm not sure the new name is better. But I'll let others decide since I'm biased, by being the author of the original proposal.
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.
supportsMethodVaries,hasVaryingSupportsMethod? But I'm not really convinced either.
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'll improve it. 😄
72de9df to2fb8ce9Compareteohhanhui commentedMay 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Search for "varying support" on some English corpus (actually the plural is corpora): https://corpus.byu.edu/coca/ They don't support direct links. |
2fb8ce9 toda5038bCompare| * file that was distributed with this source code. | ||
| */ | ||
| namespaceSymfony\Component\Serializer\Normalizer; |
teohhanhuiMay 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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've removed any mention about caching, because that is an implementation detail of what the serializer does with classes implementing this interface. I think it's better to have a pure abstraction here.
If necessary, we could document it in theSerializer class. WDYT@nicolas-grekas@dunglas?
dunglas commentedMay 11, 2018
I like this one ( |
teohhanhui commentedMay 11, 2018
Current proposed method name: Interpretation: Alternative proposed method name: Interpretation: Yes, "varied by" fares very well in the above mentioned corpus (corpora). But I'm concerned that it might be misinterpreted as: Which might cause some confusion... |
| * {@inheritdoc} | ||
| */ | ||
| publicfunctionhasCacheableSupportsMethod():bool | ||
| publicfunctionisVaryingSupportByData():bool |
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 propose:isVaryingSupport (it can also vary depending of the context).
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'd prefer that we make it explicit in the method name.
teohhanhui commentedMay 11, 2018
Okay, it seems like "varied on" is the right phrase. Source: the above mentioned corpus / corpora. |
da5038b to5a1f084Compareteohhanhui commentedMay 14, 2018
ogizanagi commentedMay 14, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
None of us are native-english speakers, so I think we should ask someone who is. EDIT: actually, |
weaverryan commentedMay 14, 2018
I actually prefer the old name :). But, if we're going to change it, from an English perspective: A) B) Sorry to muck things up further :) |
ogizanagi commentedMay 14, 2018
👍 |
dunglas commentedMay 14, 2018
Keeping the old name for me ( |
fabpot commentedMay 14, 2018
Naming is really hard :) I'm not a big fan of the current name (and don't have any great idea for better names), but I think that the current naming is still better than the alternatives. |
teohhanhui commentedMay 14, 2018
I should explain the rationale in depth. What I'm doing here is to use "support" as a noun, i.e. the concept of whether the normalizer supports normalizing / denormalizing a certain something. The previous interface name was bad for 2 major reasons:
By changing it to an interface which says how this support may vary, we borrow the same concept from the HTTP Vary header. |
nicolas-grekas commentedMay 14, 2018
HTTP vary is a list ofwhat it varies-by. Here it's a boolean. Thewhat is thus abstract. |
teohhanhui commentedMay 14, 2018
I'll do one last attempt.
|
teohhanhui commentedMay 14, 2018
I've thought of a different way that involves more than a naming change. I need to try and see if it'll actually work, but if it does I'm confident that it'll be accepted. Stay tuned! |
teohhanhui commentedMay 16, 2018
Never mind. I tried to implement my idea, but it doesn't work: <?php/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */namespaceSymfony\Component\Serializer\Normalizer;/** * Defines the interface for checking normalization / denormalization support, * where the result of the check may be safely cached. * * @author Kévin Dunglas <dunglas@gmail.com> */interface CacheableSupportInterface{/** * Checks whether the specified type and format is supported for * normalization and denormalization. * * If the return value is null, it means that support could not be * determined based on these criteria alone. Support will have to be * checked using the {@see NormalizableInterface::supportsNormalization} / * {@see DenormalizableInterface::supportsDenormalization} methods. */publicfunctionsupports(string$type, ?string$format =null): ?bool;} |
Uh oh!
There was an error while loading.Please reload this page.
Follow up from#27105.