upload: Simplify file extension extraction in UploadBase
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Thu, 28 Feb 2019 11:37:40 +0000 (12:37 +0100)
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Thu, 28 Feb 2019 11:38:52 +0000 (12:38 +0100)
The code does the exact same, just shorter and hopefully better
readable.

Change-Id: Idd1d34927a5c027d378d1a54afd23dc7f33ee004

includes/upload/UploadBase.php

index d9e8e99..d692f1a 100644 (file)
@@ -947,8 +947,8 @@ abstract class UploadBase {
                 */
                list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName );
 
-               if ( count( $ext ) ) {
-                       $this->mFinalExtension = trim( $ext[count( $ext ) - 1] );
+               if ( $ext !== [] ) {
+                       $this->mFinalExtension = trim( end( $ext ) );
                } else {
                        $this->mFinalExtension = '';