wl_notificationtimestamp code comments typo, false statement
[lhc/web/wiklou.git] / includes / MWTimestamp.php
index 447dde3..ea91470 100644 (file)
@@ -182,6 +182,11 @@ class MWTimestamp {
                        $output .= ' GMT';
                }
 
+               if ( $style == TS_MW && strlen( $output ) !== 14 ) {
+                       throw new TimestampException( __METHOD__ . ': The timestamp cannot be represented in ' .
+                               'the specified format' );
+               }
+
                return $output;
        }
 
@@ -221,7 +226,7 @@ class MWTimestamp {
                $offsetRel = $relativeTo->offsetForUser( $user );
 
                $ts = '';
-               if ( wfRunHooks( 'GetHumanTimestamp', array( &$ts, $this, $relativeTo, $user, $lang ) ) ) {
+               if ( Hooks::run( 'GetHumanTimestamp', array( &$ts, $this, $relativeTo, $user, $lang ) ) ) {
                        $ts = $lang->getHumanTimestamp( $this, $relativeTo, $user );
                }
 
@@ -238,7 +243,6 @@ class MWTimestamp {
         * @since 1.22
         *
         * @param User $user User to take preferences from
-        * @param[out] MWTimestamp $ts Timestamp to adjust
         * @return DateInterval Offset that was applied to the timestamp
         */
        public function offsetForUser( User $user ) {
@@ -268,7 +272,7 @@ class MWTimestamp {
                // first value.
                if ( $data[0] == 'System' ) {
                        // First value is System, so use the system offset.
-                       if ( isset( $wgLocalTZoffset ) ) {
+                       if ( $wgLocalTZoffset !== null ) {
                                $diff = $wgLocalTZoffset;
                        }
                } elseif ( $data[0] == 'Offset' ) {
@@ -327,7 +331,7 @@ class MWTimestamp {
 
                $ts = '';
                $diff = $this->diff( $relativeTo );
-               if ( wfRunHooks(
+               if ( Hooks::run(
                        'GetRelativeTimestamp',
                        array( &$ts, &$diff, $this, $relativeTo, $user, $lang )
                ) ) {
@@ -401,7 +405,7 @@ class MWTimestamp {
         *
         * @since 1.22
         * @param bool|string $ts Timestamp to set, or false for current time
-        * @return MWTimestamp the local instance
+        * @return MWTimestamp The local instance
         */
        public static function getLocalInstance( $ts = false ) {
                global $wgLocaltimezone;
@@ -415,7 +419,7 @@ class MWTimestamp {
         *
         * @since 1.22
         * @param bool|string $ts Timestamp to set, or false for current time
-        * @return MWTimestamp the instance
+        * @return MWTimestamp The instance
         */
        public static function getInstance( $ts = false ) {
                return new self( $ts );