Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Sep 2017 at 16:59 UTC
Updated:
18 Mar 2025 at 06:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shkiper commentedComment #3
shkiper commentedComment #4
andriyun commentedGood patch
I don't see phpcs fails related to issue sniff after patch applying
But patch doesn't have changes for phpcs.xml.dist file
We have to enable fixed sniff for further checks. See step 1 from instruction.
Please add proper sniffs to this.
To avoid fails related to other subsniffs from Drupal.Commenting.VariableComment
you will need to exclude them.
Finally you will get smth like this:
Comment #5
zaporylieI reviewed the patch, added sniff section to phpcs.xml.dist as mentioned in #4 and fixed some minor issues I have found on the way.
Comment #6
zaporylieComment #7
zaporylieComment #8
zaporylieReroll + additions added since 9 October 2017 at 00:56
Comment #9
zaporylieI went once again thoroughly through all changes introduced by last patch, and fixed places, I believe, were wrong (wrong order, incorrect data type, etc). Hope someone can find the time to make a final review.
Comment #10
martin107 commented1) I have justified all the changes to myself during a visual inspection of the patch
.. all looks good.
2) The phpcs.xml.dist was modified correctly
3) There are no remaining coding standard error in test runs output
I think this issue is ready.... everybodyWhoWorkedOnThis++
Comment #12
mfernea commentedQuick re-roll due to phpcs.xml.dist conflicts.
Comment #13
martin107 commentedThanks for the quick reroll.
I have rechecked ... everything I said in #10 is valid about this new patch.
I missed the "does the patch still apply" off my checklist
martin107--
Comment #14
xjmI love it when our coding standards cleanups also make our code more usable. :)
This issue is a bit tricker to review than other coding standards patches since one has to look up the data types for things that don't provide defaults. The following is a mix of actual review points and notes to myself...
Is this a
string[]?It's clear it can be NULL because there's a null there, and a machine name is obviously a string. So this is OK.
What kind of things are errors? Is this a render array, so
array[]? Is it a list of strings, sostring[]?A string car doesn't sound very useful. :)
Note to self: look these one up and confirm it's set in the constructor (i.e. never NULL). Scalar defaults for array values are often fragile, also, so we might find some followup issues for these.
What kinds of things are these? Sounds like maybe objects of some access check type?
Cache objects are presumably instances of some interface?
Note to self: Sounds stringy but check, and check for NULL.
It's called ArrayElement but check, and check NULL. What is it an array of?
Looks like it's a
string[][]?string[]?Note to self: Sounds like a string and having no table (NULL) for the condition sounds like invalid SQL, but double-check.
Note to self: Sounds like a string but double-check that it's never NULL.
The docs say string but the type says array. One of these is wrong.
...Or, wait. Is it the "Translation cache of format strings"?
Note to self: Obviously strings but check for null values.
Note to self: I probably need to look these up.
...That's as far as I got before got some reviewer fatigue. This is one of the coding standards issues I'd suggest splitting up. My suggestion:
@carand@param.arrayThanks!
Comment #15
zaporylieSo what do you prefer - one issue per item from list in #14 or split patch in #12 into several patch files and upload them all here?
Comment #16
zaporylieI think it's easier to control this issue by creating separate issues for first four cases from #14 list and leave 5th one here, postponed on first four.
List of child issues:
Comment #17
zaporylieTwo already landed, another two to go.
Comment #18
zaporylieThis is reroll of #12.
Comment #22
osmanThis patch includes everything else after
Comment #23
osmanRe-rolling without
<exclude name="Drupal.Commenting.VariableComment.MissingVar"/>Comment #24
mfernea commentedI don't think it's correct to use ...|false. We should use ...|bool.
The change in core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php should be included in #2924782.
Comment #25
osmanI failed to find a documentation on this actually.
In mixed types, if the bool option is only one of the values, should it be defined specifically, or simply defined as its type?
For example, if the variable can return only a string or false, should it be
@var string|boolor@var string|false?Your suggestion makes sense, as we're defining types. But I would love to read more on that if you have any resource on that.
Comment #26
mfernea commentedActually |false is ok, as can be seen here https://www.drupal.org/node/1354.
Only the other small problem remains.
Comment #27
osmanThank you for the documentation @mfernea, really good resource!
For convenience to others: https://www.drupal.org/node/1354#types
Marking this needs review per #2924782-14: Fix 'Drupal.Commenting.VariableComment.MissingVar' outside of Plugins
Comment #28
zaporylie#2924781: Missing @var annotation for scalars that do not provide default values is in 🎉
Comment #32
quietone commentedComment #38
quietone commentedThe child issue to enable rule had too many changes. So I split that up and this will become the final one to enable the sniff and fix any stragglers when all the children are committed.
Comment #39
quietone commentedThe child issue #2924782: Fix 'Drupal.Commenting.VariableComment.MissingVar' outside of Plugins is small enough to fix the remaining violations and enable the sniff. So, I am closing this as a duplicate of that one and moving credit.
Comment #40
quietone commentedDue to recent commits of coding standard fixes, there are too many changes to fix and enable this sniff in #2924782: Fix 'Drupal.Commenting.VariableComment.MissingVar' outside of Plugins. So, opening this up again to do the final enable and fixes.
Comment #41
quietone commentedCreated MR with what should be the remaining fixes.
And postponing on the last child.
Comment #43
quietone commentedComment #44
quietone commentedComment #45
quietone commentedComment #54
quietone commentedClosed sibling issue #2924782: Fix 'Drupal.Commenting.VariableComment.MissingVar' outside of Plugins as a duplicate and transferring credit here.
Comment #55
quietone commentedThe child issues have been fixed, so time to fix the stragglers and enable the sniff.
Comment #56
borisson_I think this is ready, the rule is enabled and the remaining issues are fixed.
Comment #59
nod_Committed b9f3fe7 and pushed to 11.x. Thanks!
Comment #61
nod_