Merge "Http::getProxy() method to get proxy configuration"
[lhc/web/wiklou.git] / includes / session / SessionProvider.php
index 0fd3a71..1975ee8 100644 (file)
@@ -166,12 +166,12 @@ abstract class SessionProvider implements SessionProviderInterface, LoggerAwareI
         */
        public function newSessionInfo( $id = null ) {
                if ( $this->canChangeUser() && $this->persistsSessionId() ) {
-                       return new SessionInfo( $this->priority, array(
+                       return new SessionInfo( $this->priority, [
                                'id' => $id,
                                'provider' => $this,
                                'persisted' => false,
                                'idIsSafe' => true,
-                       ) );
+                       ] );
                }
                return null;
        }
@@ -186,12 +186,17 @@ abstract class SessionProvider implements SessionProviderInterface, LoggerAwareI
         * @param array $savedMetadata Saved provider metadata
         * @param array $providedMetadata Provided provider metadata
         * @return array Resulting metadata
-        * @throws \UnexpectedValueException If the metadata cannot be merged
+        * @throws MetadataMergeException If the metadata cannot be merged
         */
        public function mergeMetadata( array $savedMetadata, array $providedMetadata ) {
                foreach ( $providedMetadata as $k => $v ) {
                        if ( array_key_exists( $k, $savedMetadata ) && $savedMetadata[$k] !== $v ) {
-                               throw new \UnexpectedValueException( "Key \"$k\" changed" );
+                               $e = new MetadataMergeException( "Key \"$k\" changed" );
+                               $e->setContext( [
+                                       'old_value' => $savedMetadata[$k],
+                                       'new_value' => $v,
+                               ] );
+                               throw $e;
                        }
                }
                return $providedMetadata;
@@ -367,7 +372,7 @@ abstract class SessionProvider implements SessionProviderInterface, LoggerAwareI
         * @return array
         */
        public function getVaryHeaders() {
-               return array();
+               return [];
        }
 
        /**
@@ -376,7 +381,7 @@ abstract class SessionProvider implements SessionProviderInterface, LoggerAwareI
         * @return string[]
         */
        public function getVaryCookies() {
-               return array();
+               return [];
        }
 
        /**