Closed (duplicate)
Project:
Drupal core
Version:
11.x-dev
Component:
composer
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 May 2020 at 16:44 UTC
Updated:
18 Jun 2025 at 00:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hussainwebHere's an attempt.
Comment #3
kristen polThanks for the patch.
1) Looked at a few
@returnexamples in the codebase and found no consistency. Some start with "An array..." or similar mention of "array" while others don't mention array at all. Since it's obvious it's an array, IMO it doesn't need to mention "array" explicitly. Using "list" seems fine as an alternative, or anything that is clear. That said, here's some feedback on the wording:Consider simplifying and using "List of" like the others, e.g.
List of all composer.json file paths in Drupal core.
Consider being more explicit about the data in the array, e.g.
List of scaffold files with destination path, source path, and named destination location.
Or, an alternative without explicit parameter ordering that is just one line and has more generic wording:
List of scaffold files with destination and source locations.
Consider simplifying, e.g.
List of class properties that contain vendor package files to clean up.
2) Noticed a couple other things that could be updated in this file while adding these:
a) Missing periods.
b) Missing
@params.3) Marking back to "Needs work" to consider 1 & 2.
Comment #4
mrinalini9 commentedUpdate patch with the changes mentioned in #3.
Comment #5
kishor_kolekar commentedComment #6
kristen polThanks for the update. Not sure what happened to the arrays though. Maybe I'm missing something... tired and need sleep :)
list => array
list => array
list => array[]
Comment #7
mrinalini9 commentedHi,
Updated patch as per the changes mentioned in #6.
Comment #8
mrinalini9 commentedComment #9
kristen polThanks. I'll try to review tomorrow.
Comment #10
kristen polThanks for the update.
1) Reviewed the interdiff in #7 and it addresses items in #6.
2) Patch applies cleanly to 9.0 and 9.1 but not 8.9.
3) Reviewed the code again and have one question.
Not sure why "mixed" is use. I do see it used in a few places but it's mostly string:
e.g.
Comment #11
mrinalini9 commentedHi @Kristen Pol,
Thanks for the review. I have used 'mixed' for $class as I got the reference from the php.net official website, which is using the 'mixed' datatype for $class in ReflectionProperty class here.
Comment #12
kristen polThanks for the explanation. Looks RTBC to me and patch applied to 9.0 and 9.1. Not sure if this would be backported.
Comment #13
xjmThanks for working on this -- always good to see our docs improved.
Usually, we like to see coding standards cleanups across all of core for a single rule, but for issues that add new parameter and return documentation, it makes sense to work just on one API (since one has to read and understand the code in order to document it). Therefore, I think the scope of this issue is correct.
If we're correcting parameter and return type docs for this class, we should also make the return doc type more specific than
array. (Is it astring? Etc.)There should be a blank line before the start of the
@paramsection.Also, "Name of the class" sounds like a string. Is it the name of the class, or is it the class? (Looking at the code, I think it's the class).
mixedis indeed very rarely used, but in this case seems accurate. Thanks @mrinalini9 for providing the reference there!Moving to 8.8.x since documentation improvements are eligible for backport to the production branch. Thanks again!
Comment #14
xjmOh also, I think this isn't just a list. (If it were, it'd be
string[][]or such. It's an array of arrays where the first element is the class and the second element is the property name. (I think). Also, it's not a list, it's an array of test cases.So let's consider a little more what the docs should say here.
Comment #15
mrinalini9 commentedComment #16
mrinalini9 commentedComment #17
mrinalini9 commentedPatch for 8.8.x, please review.
For the above query:
1.
For example:
providerTestComposerJson(): This function returns $data which is an array and it will contain the list of all composer.json file paths which I do have mentioned in the code doc. So, I think this should be fine.Comment #18
mrinalini9 commentedComment #19
kristen polRegarding #14, I was thinking of a list in a general sense not a "type" sense. Here are some examples already in use so these might help us reword the comments:
core/modules/user/src/PermissionHandler.phpcore/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.phpcore/lib/Drupal/Core/Test/JUnitConverter.phpComment #20
nitesh624Comment #21
nitesh624Replace
@return arrayto@return array[]as per suggestion in #14 and #19Comment #22
nitesh624Comment #23
kristen polTo be clear, I didn't suggest changing the type in 19, I was simply providing some sample comments so we can figure out better documentation. Maybe the types should be changed but I haven't thought about that yet.
Comment #25
kristen polNote that patch still applies cleanly to 9.1.x.
Comment #26
janmejaig commentedI have tested , this document seems to be fine from my end and have added test for the 9.1.x .
Comment #27
tanubansal commentedRTBC + 1 from my end as well on 9.1
Comment #33
smustgrave commentedIf we are fine with @return array[] then this looks good.
Comment #34
xjmActually, #14 and #19 have not been addressed. Reiterating: the current documentation is inaccurate -- it is not just a "list" -- and it is in scope for this issue to fix it.
Comment #35
xjm#13.2 (second part beginning with "Also...") has not been addressed either.
Comment #37
quietone commentedThis has been fixed in #2721309: Fix Drupal.Commenting.FunctionComment.ParamCommentFullStop and #3504774: Fix Drupal.Commenting.FunctionComment.MissingReturnComment in core/tests,
Comment #38
xjmThe issue credits should be transferred over then :)
Comment #39
xjmAlso, the correct issue status for that is closed dupe. :)
Comment #40
smustgrave commented@xjm closed issues get credit now so if they’re checked here they’ll get something.
If we move over then we should uncheck here too else we are giving double
Comment #41
smustgrave commentedComment #42
smustgrave commentedUploading a screenshot to show.
Comment #43
xjmWhoa! Did not know that. Thanks @smustgrave!