Convert all array() syntax to []
[lhc/web/wiklou.git] / includes / filebackend / FileBackend.php
index 8d76e96..fd9c8de 100644 (file)
@@ -143,10 +143,10 @@ abstract class FileBackend {
                }
                $this->lockManager = isset( $config['lockManager'] )
                        ? $config['lockManager']
-                       : new NullLockManager( array() );
+                       : new NullLockManager( [] );
                $this->fileJournal = isset( $config['fileJournal'] )
                        ? $config['fileJournal']
-                       : FileJournal::factory( array( 'class' => 'NullFileJournal' ), $this->name );
+                       : FileJournal::factory( [ 'class' => 'NullFileJournal' ], $this->name );
                $this->readOnly = isset( $config['readOnly'] )
                        ? (string)$config['readOnly']
                        : '';
@@ -365,7 +365,7 @@ abstract class FileBackend {
         * @param array $opts Batch operation options
         * @return Status
         */
-       final public function doOperations( array $ops, array $opts = array() ) {
+       final public function doOperations( array $ops, array $opts = [] ) {
                if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
                        return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
@@ -398,8 +398,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function doOperation( array $op, array $opts = array() ) {
-               return $this->doOperations( array( $op ), $opts );
+       final public function doOperation( array $op, array $opts = [] ) {
+               return $this->doOperations( [ $op ], $opts );
        }
 
        /**
@@ -412,8 +412,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function create( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'create' ) + $params, $opts );
+       final public function create( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'create' ] + $params, $opts );
        }
 
        /**
@@ -426,8 +426,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function store( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'store' ) + $params, $opts );
+       final public function store( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'store' ] + $params, $opts );
        }
 
        /**
@@ -440,8 +440,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function copy( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'copy' ) + $params, $opts );
+       final public function copy( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'copy' ] + $params, $opts );
        }
 
        /**
@@ -454,8 +454,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function move( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'move' ) + $params, $opts );
+       final public function move( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'move' ] + $params, $opts );
        }
 
        /**
@@ -468,8 +468,8 @@ abstract class FileBackend {
         * @param array $opts Operation options
         * @return Status
         */
-       final public function delete( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'delete' ) + $params, $opts );
+       final public function delete( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'delete' ] + $params, $opts );
        }
 
        /**
@@ -483,8 +483,8 @@ abstract class FileBackend {
         * @return Status
         * @since 1.21
         */
-       final public function describe( array $params, array $opts = array() ) {
-               return $this->doOperation( array( 'op' => 'describe' ) + $params, $opts );
+       final public function describe( array $params, array $opts = [] ) {
+               return $this->doOperation( [ 'op' => 'describe' ] + $params, $opts );
        }
 
        /**
@@ -597,7 +597,7 @@ abstract class FileBackend {
         * @return Status
         * @since 1.20
         */
-       final public function doQuickOperations( array $ops, array $opts = array() ) {
+       final public function doQuickOperations( array $ops, array $opts = [] ) {
                if ( empty( $opts['bypassReadOnly'] ) && $this->isReadOnly() ) {
                        return Status::newFatal( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
@@ -630,7 +630,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function doQuickOperation( array $op ) {
-               return $this->doQuickOperations( array( $op ) );
+               return $this->doQuickOperations( [ $op ] );
        }
 
        /**
@@ -644,7 +644,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function quickCreate( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'create' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'create' ] + $params );
        }
 
        /**
@@ -658,7 +658,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function quickStore( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'store' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'store' ] + $params );
        }
 
        /**
@@ -672,7 +672,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function quickCopy( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'copy' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'copy' ] + $params );
        }
 
        /**
@@ -686,7 +686,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function quickMove( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'move' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'move' ] + $params );
        }
 
        /**
@@ -700,7 +700,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function quickDelete( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'delete' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'delete' ] + $params );
        }
 
        /**
@@ -714,7 +714,7 @@ abstract class FileBackend {
         * @since 1.21
         */
        final public function quickDescribe( array $params ) {
-               return $this->doQuickOperation( array( 'op' => 'describe' ) + $params );
+               return $this->doQuickOperation( [ 'op' => 'describe' ] + $params );
        }
 
        /**
@@ -904,7 +904,7 @@ abstract class FileBackend {
         */
        final public function getFileContents( array $params ) {
                $contents = $this->getFileContentsMulti(
-                       array( 'srcs' => array( $params['src'] ) ) + $params );
+                       [ 'srcs' => [ $params['src'] ] ] + $params );
 
                return $contents[$params['src']];
        }
@@ -1026,7 +1026,7 @@ abstract class FileBackend {
         */
        final public function getLocalReference( array $params ) {
                $fsFiles = $this->getLocalReferenceMulti(
-                       array( 'srcs' => array( $params['src'] ) ) + $params );
+                       [ 'srcs' => [ $params['src'] ] ] + $params );
 
                return $fsFiles[$params['src']];
        }
@@ -1059,7 +1059,7 @@ abstract class FileBackend {
         */
        final public function getLocalCopy( array $params ) {
                $tmpFiles = $this->getLocalCopyMulti(
-                       array( 'srcs' => array( $params['src'] ) ) + $params );
+                       [ 'srcs' => [ $params['src'] ] ] + $params );
 
                return $tmpFiles[$params['src']];
        }
@@ -1146,7 +1146,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function getTopDirectoryList( array $params ) {
-               return $this->getDirectoryList( array( 'topOnly' => true ) + $params );
+               return $this->getDirectoryList( [ 'topOnly' => true ] + $params );
        }
 
        /**
@@ -1184,7 +1184,7 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public function getTopFileList( array $params ) {
-               return $this->getFileList( array( 'topOnly' => true ) + $params );
+               return $this->getFileList( [ 'topOnly' => true ] + $params );
        }
 
        /**
@@ -1357,12 +1357,12 @@ abstract class FileBackend {
                                if ( count( $parts ) == 3 ) {
                                        return $parts; // e.g. "backend/container/path"
                                } else {
-                                       return array( $parts[0], $parts[1], '' ); // e.g. "backend/container"
+                                       return [ $parts[0], $parts[1], '' ]; // e.g. "backend/container"
                                }
                        }
                }
 
-               return array( null, null, null );
+               return [ null, null, null ];
        }
 
        /**
@@ -1442,10 +1442,10 @@ abstract class FileBackend {
         * @since 1.20
         */
        final public static function makeContentDisposition( $type, $filename = '' ) {
-               $parts = array();
+               $parts = [];
 
                $type = strtolower( $type );
-               if ( !in_array( $type, array( 'inline', 'attachment' ) ) ) {
+               if ( !in_array( $type, [ 'inline', 'attachment' ] ) ) {
                        throw new FileBackendError( "Invalid Content-Disposition type '$type'." );
                }
                $parts[] = $type;