Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Language negotiation methods (plugins and entities) have integer weights. In #2195573: Add a dedicated @LanguageNegotiation annotation class we discovered a few places in which they were documented as floats (fixed there) or not documented at all. This issue aims to fix the remaining type errors.
Proposed resolution
Correct all documentation to say these values are integers.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal_2494679_9.patch | 1.94 KB | Xano |
#9 | interdiff.txt | 652 bytes | Xano |
Comments
Comment #1
XanoThere seemed to be only one occurrence, so let's repurpose this issue to fix all type hint docblocks in
LanguageNegotiatorInterface
.Comment #2
jhodgdonThese changes look good to me, thanks!
Comment #3
webchickHm. "mixed[]" feels less clear to me than "array." Especially given the definition is "An array of..." Is that the standard? It doesn't seem like it...
Comment #4
cilefen CreditAttribution: cilefen commentedComment #5
Xanomixed[]
means "an array of items of any type", whereasarray
means "an array of figure it out yourself". The former is definitely much more explicit.Comment #6
jhodgdonI kind of agree with #5 but apparently we are not doing that in Core much if at all, so maybe we should make it just array again and make sure that the docs for the param/return actually say what is in the array?
Comment #7
Xanomixed[]
is allowed by our coding standards, and it's more specific thanarray
. If the rest of core doesn't use it, that's because this format is relatively new (it was introduced sometime during the last 12 months). There is no reason not start using it.Comment #8
jhodgdonIMO mixed[] doesn't really give any more information than just "array" though. All it says is "it's an array of stuff", and you'd still need to see the code or docs to figure out what the "stuff" is, just like if it just said "array". Right?
So can we be more specific on this one? The docs say:
What is a "language negotiation method definition" -- is it an array or an object or some kind of class?
Comment #9
Xanomixed[]
explicitly says you're getting an array of differently typed data.array
only says it's an array, but you're going to have to do some research first to find out the array's contents are of different types. We already know the contents are of different types, so let's be nice to developers and tell them what they can expect as specifically as possible, so they won't have to spend time figuring that out themselves.Ah, I admit that in this case I should have used
array[]
instead, as language negotiator definitions are arrays. I completely missed that in earlier comments, for which my apologies. Once #2195573: Add a dedicated @LanguageNegotiation annotation class gets in, we can add an@see
to the annotation to this method.Comment #14
jhodgdonThis all looks reasonable to me (again). Thanks!
Comment #15
alexpottDocs only changes are permitted in beta. Committed 2466bc0 and pushed to 8.0.x. Thanks!
Comment #17
alexpott