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.
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21DrupalKer...
The docblock should say what the assumptions are, and the code should document this hideous expression:
dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
Comment | File | Size | Author |
---|---|---|---|
#13 | DrupalKernel--guessApplicationRoot-c-updated-2905109-13.patch | 895 bytes | msankhala |
#12 | 2905109-12.patch | 797 bytes | gawaksh |
#9 | 2905109-9.patch | 722 bytes | gawaksh |
#5 | 2905109-4.patch | 1.05 KB | iainp999 |
#4 | 2905109-3.patch | 1007 bytes | iainp999 |
Comments
Comment #2
iainp999 CreditAttribution: iainp999 as a volunteer commentedHi @joachim
Are the comments in the attached patch correct? Do they cover this or is there more to say?
Thanks.
Comment #3
iainp999 CreditAttribution: iainp999 as a volunteer commentedComment #4
iainp999 CreditAttribution: iainp999 as a volunteer commentedOops, sorry. Initial docblock wasn't quite right. New patch attached. (Didn't bother with interdiff, since this is small).
Comment #5
iainp999 CreditAttribution: iainp999 as a volunteer commentedOr perhaps the attached is better?
Comment #7
borisson_I agree, I think this is a good idea to add the assumptions in the documentation of this method.
Comment #8
alexpottI don't think repeating the documentation about the implementation helps. It means that if we can the implementation we have to change documentation. I think what I'd do is change
Determine the application root directory based on assumptions.
toDetermine the application root directory based on this file's location.
and then only have the inline comments next to the code as the implementation is probably not that important to the caller.The inline comments current don't obey the API docs standard - there is no empty line in-between the colon and that first hyphen. See https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...
Comment #9
gawaksh CreditAttribution: gawaksh at OpenSense Labs for DrupalFit commentedThis patch might fulfil the requirements.
Comment #10
gawaksh CreditAttribution: gawaksh at OpenSense Labs for DrupalFit commentedComment #11
borisson_The suggestion in #9 doesn't do what @alexpott suggested in #8.
Comment #12
gawaksh CreditAttribution: gawaksh at OpenSense Labs for DrupalFit commentedHere's a fresh patch after the changes.
Comment #13
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is a patch as per suggestion in #8 by @alexpott.
Comment #15
joachim CreditAttribution: joachim as a volunteer commentedLGTM. Thanks!
Comment #18
alexpottCommitted 03a3058 and pushed to 8.7.x and 8.6.x. Thanks!