Closed (fixed)
Project:
Drupal core
Version:
11.1.x-dev
Component:
documentation
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Oct 2015 at 17:40 UTC
Updated:
9 May 2025 at 09:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
David_Rothstein commentedHere's a patch.
The first part seems worth slipping in here (I already included it in the Drupal 7 commit for the above issue).
The second part is the main change. It might actually make sense to change the code so the 'project' key is always present (it could be set to NULL if there is no project specified) but for now this patch just documents the current behavior.
Comment #3
jhodgdonNormally to indicate that something is optional in a list, the syntax is:
Comment #4
trobey commentedIn this case we have
* - (key): (optional) Information goes hereWhich could be confusing since it implies (optional) is part of the string to appear in the file. For the case when the key is enclosed in parenthesis the following probably makes the break between the file syntax and description of the syntax clearer
* - (key): Optional key, information goes hereThis is followed elsewhere so it is not new. So I think the current patch is fine.
Comment #5
jhodgdonThis (optional) is the standard way to do this. See:
https://www.drupal.org/node/1354#lists
Comment #6
snehi commentedPlease review attached one.
Comment #7
jhodgdonThanks! Closer...
(optional) should be lower-case by convention.
Also in this case "(versions)" is what is actually in the string here, and you'd need to omit that whole piece for this to work, so I think we should leave the parens on (versions) here?
Comment #8
snehi commentedYou mean to say only
will work ?
Comment #9
jhodgdonShould say:
Comment #10
snehi commentedDone. Thanks !!
Comment #11
jhodgdonThanks!
Comment #12
xjmAs a docs-only fix, this change is rc eligible. Reference: https://www.drupal.org/core/d8-allowed-changes#rc
The array key
(versions)is really wrapped in parentheses? Huh. :)Shouldn't this also use our standard format for associative arrays? E.g.:
NW for #2; it seems to be in the scope stated in the issue title. Thanks!
Comment #13
jhodgdonGood idea! Might as well make the docs even better. :)
Comment #14
anil280988 commentedDone Changes
Comment #15
MixologicDoing some testbot maintenance and need to kill the test run in #14. Since it is only affecting comments, I assume that's fine.
Comment #17
jhodgdonThanks! The changes in ModuleHandler look good. But:
The patch in #10 was correct in this line. This patch isn't. Please go back to the patch in #10 version.
Comment #18
snehi commentedDone.
Comment #19
jhodgdonThis line is still wrong. Again, please go back to the patch in #10 for this line.
Comment #20
snehi commentedComment #22
snehi commentedComment #24
jhodgdonThanks! This looks fine. We could change
@return
to
@return array
in the second hunk, but at least this documentation is better.
Comment #26
alexpottI'm not sure (optional) makes much sense in an @return - I think we need to document why it is present when it is.
Comment #27
rakesh.gectcrWe don't really need that (optional) .
Comment #28
rakesh.gectcrComment #29
anil280988 commentedHi All,
In the API (https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ModuleH...), It state that 3 values are returned,so Have removed optional key.
Comment #31
jhodgdonI'm sorry, but I don't think either of the two patches here is correct.
If you look at the code linked in #29, you'll see in the first few lines:
So definitely 'project' can be returned, but it is not always returned. So the patch in #29 is incorrect.
The patch in #27 is also unclear. It says it can return 3 or 4 keys, which is correct, but it doesn't say which one is sometimes not there or why. In #26, @alexpott requested that we not use (optional) in there to describe this, which I agree with. But we still need to put something in there to tell people that project might be missing, and why.
Also, whoever is working on the next patch, please start by assigning the issue to yourself first, so that we don't have two people submitting patches on the same issue. That is a waste of time, both for people making the patches and for reviewers. Thanks!
Comment #45
quietone commentedThe documentation that was in the ModuleHandler is now in \Drupal\Core\Extension\Dependency::createFromString and has since been updated. I don't think that requires a change anymore. What is left is simply to add (optional). I have updated the issue summary
Comment #46
quietone commentedComment #47
brandonlira commentedComment #53
brandonlira commentedHi all,
I have created a new MR !11528 with the necessary documentation update.
This is now ready for review. Let me know if any further adjustments are needed.
Thanks!
Comment #54
brandonlira commentedComment #55
nexusnovaz commentedThe change is simple and LGTM. Seems the error is unrelated through im not able to rerun the job?
Comment #56
quietone commentedThis needs another adjustment to meet coding standards.
Comment #58
sivaji_ganesh_jojodae commentedUpdated to reflect comment #55.
Comment #59
smustgrave commentedSeems pretty straight forward.
Comment #62
quietone commentedNice to get this finally fixed!