From 495040e614b0726c465696d590aae4416d0f8c9e Mon Sep 17 00:00:00 2001 From: Reedy Date: Wed, 18 Jun 2014 22:53:07 +0100 Subject: [PATCH] Update Language::userAdjust() $ts parameter hint to be string Will technically still take an int (it's parsed around anyway), but should be passed as a string Mostly for HipHop stuffs Change-Id: Id940028d581e34ca2e37a0730ca5766a08fc10e2 --- languages/Language.php | 10 +++++----- tests/phpunit/includes/TimeAdjustTest.php | 24 +++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/languages/Language.php b/languages/Language.php index 9d3f5e9c98..e505b287e5 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1880,7 +1880,7 @@ class Language { /** * Used by date() and time() to adjust the time output. * - * @param int $ts The time in date('YmdHis') format + * @param string $ts The time in date('YmdHis') format * @param mixed $tz Adjust the time by this amount (default false, mean we * get user timecorrection setting) * @return int @@ -2020,7 +2020,7 @@ class Language { } /** - * @param mixed $ts The time format which needs to be turned into a + * @param string $ts The time format which needs to be turned into a * date('YmdHis') format with wfTimestamp(TS_MW,$ts) * @param bool $adj Whether to adjust the time output according to the * user configured offset ($timecorrection) @@ -2039,7 +2039,7 @@ class Language { } /** - * @param mixed $ts The time format which needs to be turned into a + * @param string $ts The time format which needs to be turned into a * date('YmdHis') format with wfTimestamp(TS_MW,$ts) * @param bool $adj Whether to adjust the time output according to the * user configured offset ($timecorrection) @@ -2058,7 +2058,7 @@ class Language { } /** - * @param mixed $ts The time format which needs to be turned into a + * @param string $ts The time format which needs to be turned into a * date('YmdHis') format with wfTimestamp(TS_MW,$ts) * @param bool $adj Whether to adjust the time output according to the * user configured offset ($timecorrection) @@ -2149,7 +2149,7 @@ class Language { * Internal helper function for userDate(), userTime() and userTimeAndDate() * * @param string $type Can be 'date', 'time' or 'both' - * @param mixed $ts The time format which needs to be turned into a + * @param string $ts The time format which needs to be turned into a * date('YmdHis') format with wfTimestamp(TS_MW,$ts) * @param User $user User object used to get preferences for timezone and format * @param array $options Array, can contain the following keys: diff --git a/tests/phpunit/includes/TimeAdjustTest.php b/tests/phpunit/includes/TimeAdjustTest.php index 0b368c251d..f0d4c4dcb8 100644 --- a/tests/phpunit/includes/TimeAdjustTest.php +++ b/tests/phpunit/includes/TimeAdjustTest.php @@ -3,8 +3,6 @@ class TimeAdjustTest extends MediaWikiLangTestCase { protected function setUp() { parent::setUp(); - - $this->iniSet( 'precision', 15 ); } /** @@ -18,7 +16,7 @@ class TimeAdjustTest extends MediaWikiLangTestCase { $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset ); $this->assertEquals( - strval( $expected ), + $expected, strval( $wgContLang->userAdjust( $date, '' ) ), "User adjust {$date} by {$localTZoffset} minutes should give {$expected}" ); @@ -26,16 +24,16 @@ class TimeAdjustTest extends MediaWikiLangTestCase { public static function dataUserAdjust() { return array( - array( 20061231235959, 0, 20061231235959 ), - array( 20061231235959, 5, 20070101000459 ), - array( 20061231235959, 15, 20070101001459 ), - array( 20061231235959, 60, 20070101005959 ), - array( 20061231235959, 90, 20070101012959 ), - array( 20061231235959, 120, 20070101015959 ), - array( 20061231235959, 540, 20070101085959 ), - array( 20061231235959, -5, 20061231235459 ), - array( 20061231235959, -30, 20061231232959 ), - array( 20061231235959, -60, 20061231225959 ), + array( '20061231235959', 0, '20061231235959' ), + array( '20061231235959', 5, '20070101000459' ), + array( '20061231235959', 15,'20070101001459' ), + array( '20061231235959', 60, '20070101005959' ), + array( '20061231235959', 90, '20070101012959' ), + array( '20061231235959', 120, '20070101015959' ), + array( '20061231235959', 540, '20070101085959' ), + array( '20061231235959', -5, '20061231235459' ), + array( '20061231235959', -30, '20061231232959' ), + array( '20061231235959', -60, '20061231225959' ), ); } } -- 2.20.1