[wp-trac] [WordPress Trac] #45203: Document all optional parameters as optional in add_image_size()

WordPress Trac noreply at wordpress.org
Fri Oct 26 16:52:04 UTC 2018


#45203: Document all optional parameters as optional in add_image_size()
----------------------------+------------------------------
 Reporter:  DrewAPicture    |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Media           |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  good-first-bug  |     Focuses:  docs
----------------------------+------------------------------
Description changed by DrewAPicture:

Old description:

> The parameter descriptions for the optional `$width` and `$height`
> parameters for `add_image_size()` are not currently notated as such.
> Let's fix that.
>
> For guidance on how to document optional parameters, note how the
> description for the optional third parameter, `$crop`, is formatted.
>
> {{{#!php
> <?php
>  *
>  * @param string     $name   Image size identifier.
>  * @param int        $width  Image width in pixels.
>  * @param int        $height Image height in pixels.
>  * @param bool|array $crop   Optional. Whether to crop images to
> specified width and height or resize.
>  *                           An array can specify positioning of the crop
> area. Default false.
>  */
> function add_image_size( $name, $width = 0, $height = 0, $crop = false )
> {
> ...
> }}}

New description:

 The parameter descriptions for the optional `$width` and `$height`
 parameters for `add_image_size()` are not currently notated as such. Let's
 fix that.

 For guidance on how to document optional parameters, note how the
 description for the optional fourth parameter, `$crop`, is formatted.

 {{{#!php
 <?php
  *
  * @param string     $name   Image size identifier.
  * @param int        $width  Image width in pixels.
  * @param int        $height Image height in pixels.
  * @param bool|array $crop   Optional. Whether to crop images to specified
 width and height or resize.
  *                           An array can specify positioning of the crop
 area. Default false.
  */
 function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
 ...
 }}}

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45203#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list