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.
Comments
Comment #2
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 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