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
There is a mistake in comment documenting function image
of the Random
class.
See: https://git.drupalcode.org/project/drupal/blob/8.8.x/core/lib/Drupal/Com...
/**
* Create a placeholder image.
*
* @param string $destination
* The absolute file path where the image should be stored.
* @param int $min_resolution
* @param int $max_resolution
*
* @return string
* Path to image file.
*/
public function image($destination, $min_resolution, $max_resolution) {
$extension = pathinfo($destination, PATHINFO_EXTENSION);
$min = explode('x', $min_resolution);
$max = explode('x', $max_resolution);
$min_resolution, $max_resolution
are actually strings in the form of e.g. '400x400' , which becomes obvious after reading the beginning of the image
method.
Comment | File | Size | Author |
---|---|---|---|
#4 | comment-fix-3076644-4.patch | 735 bytes | Luke_Nuke |
#2 | comment-fix-3076644-2.patch | 659 bytes | Luke_Nuke |
Comments
Comment #2
Luke_Nuke CreditAttribution: Luke_Nuke commentedSimple patch attached.
Comment #3
gueguerreiroNice catch, thank you for the patch.
Some nitpicks:
The following coding standards errors:
The example is fine, because the correct format the function expects is not immediately obvious. But I don't think they are a replacement for a description. I think it would be better if the parameters had a description, and then an example at the end. It can be something short and obvious, like "The minimum/maximum resolution for the image. E.g '400x400'.".
Comment #4
Luke_Nuke CreditAttribution: Luke_Nuke commentedThanks for a feedback. These are fixed now.
Comment #5
gueguerreiroGreat! That looks good, thank you.
Comment #6
alexpottCommitted b7d22d5 and pushed to 8.8.x. Thanks!
I think the g in e.g. is always supposed to be followed by a dot but rather than enter that discussion I chose to replace it with
For example,
as this is clearer and requires less latin :)Comment #8
alexpott