mirror of
git://develop.git.wordpress.org/
synced 2025-03-24 22:10:02 +01:00
Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Image_Editor::save()
.
Renames the first parameter in `WP_Image_Editor_GD::save()` to match the parent's method signature. Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match. Adds @since to clearly specify why the change happened. Adds parameter descriptions to parent and both child classes. Follow-up to [22094], [22619], [30681]. Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion. See #51553. git-svn-id: https://develop.svn.wordpress.org/trunk@51790 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cc1632c046
commit
50d7248e1e
@ -423,13 +423,15 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
* Saves current in-memory image to file.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @since 5.9.0 Renamed `$filename` to `$destfilename` to match parent class
|
||||
* for PHP 8 named parameter support.
|
||||
*
|
||||
* @param string|null $filename
|
||||
* @param string|null $mime_type
|
||||
* @param string|null $destfilename Optional. Destination filename. Default null.
|
||||
* @param string|null $mime_type Optional. The mime-type. Default null.
|
||||
* @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
|
||||
*/
|
||||
public function save( $filename = null, $mime_type = null ) {
|
||||
$saved = $this->_save( $this->image, $filename, $mime_type );
|
||||
public function save( $destfilename = null, $mime_type = null ) {
|
||||
$saved = $this->_save( $this->image, $destfilename, $mime_type );
|
||||
|
||||
if ( ! is_wp_error( $saved ) ) {
|
||||
$this->file = $saved['path'];
|
||||
|
@ -662,8 +662,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param string $destfilename
|
||||
* @param string $mime_type
|
||||
* @param string $destfilename Optional. Destination filename. Default null.
|
||||
* @param string $mime_type Optional. The mime-type. Default null.
|
||||
* @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
|
||||
*/
|
||||
public function save( $destfilename = null, $mime_type = null ) {
|
||||
|
@ -77,8 +77,8 @@ abstract class WP_Image_Editor {
|
||||
* @since 3.5.0
|
||||
* @abstract
|
||||
*
|
||||
* @param string $destfilename
|
||||
* @param string $mime_type
|
||||
* @param string $destfilename Optional. Destination filename. Default null.
|
||||
* @param string $mime_type Optional. The mime-type. Default null.
|
||||
* @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
|
||||
*/
|
||||
abstract public function save( $destfilename = null, $mime_type = null );
|
||||
|
Loading…
x
Reference in New Issue
Block a user