diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 68d8090..2725560 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,147 +1,8 @@ name: qa on: [push, pull_request] jobs: - PHP5_3: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '5.3' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - PHP5_4: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '5.4' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP5_5: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '5.5' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP5_6: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '5.6' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP7_0: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.0' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP7_1: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.1' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP7_2: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.2' - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: vendor/bin/phpunit -c tests/build.xml - - PHP7_3: + PHP7_4: runs-on: ubuntu-latest steps: - name: Checkout @@ -150,7 +11,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.3' + php-version: '7.4' - name: Validate composer.json and composer.lock run: composer validate @@ -161,7 +22,7 @@ jobs: - name: Run PHPUnit run: vendor/bin/phpunit -c tests/build.xml - PHP7_4: + PHP8_0: runs-on: ubuntu-latest steps: - name: Checkout @@ -170,7 +31,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: '8.0' - name: Validate composer.json and composer.lock run: composer validate @@ -181,7 +42,7 @@ jobs: - name: Run PHPUnit run: vendor/bin/phpunit -c tests/build.xml - PHP8_0: + PHP8_1: runs-on: ubuntu-latest steps: - name: Checkout @@ -190,7 +51,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.1' - name: Validate composer.json and composer.lock run: composer validate diff --git a/src/Moment.php b/src/Moment.php index b62175e..490145c 100755 --- a/src/Moment.php +++ b/src/Moment.php @@ -91,6 +91,7 @@ public static function fromDateTime(\DateTimeInterface $date) * @return static|false Returns a new Moment instance or FALSE on failure. * @throws MomentException */ + #[\ReturnTypeWillChange] public static function createFromFormat($format, $time, $timezone = null, FormatsInterface $formatsInterface = null) { // handle diverse format types @@ -212,6 +213,7 @@ public function resetDateTime($dateTime = 'now', $timezone = null) * * @return \DateTime|Moment */ + #[\ReturnTypeWillChange] public function setTimezone($timezone) { if ($this->immutableMode) @@ -238,6 +240,7 @@ public function setTimezone($timezone) * @return string * @throws MomentException */ + #[\ReturnTypeWillChange] public function format($format = null, $formatsInterface = null) { // set default format @@ -591,6 +594,7 @@ public function getYear() * * @return self|\DateTime */ + #[\ReturnTypeWillChange] public function setDate($year, $month, $day) { if ($this->immutableMode) @@ -692,6 +696,7 @@ public function getHour() * * @return $this|\DateTime */ + #[\ReturnTypeWillChange] public function setTime($hour, $minute, $second = null, $microseconds = null) { if ($this->immutableMode) diff --git a/tests/build.xml b/tests/build.xml index f1065cf..0441aba 100755 --- a/tests/build.xml +++ b/tests/build.xml @@ -1,14 +1,13 @@ - - - - - unit - - - - - ../src/ - - + + + + ../src/ + + + + + unit + + diff --git a/tests/unit/Moment/MomentBritishEnglishLocaleTest.php b/tests/unit/Moment/MomentBritishEnglishLocaleTest.php index 7bc3716..a2f19f1 100644 --- a/tests/unit/Moment/MomentBritishEnglishLocaleTest.php +++ b/tests/unit/Moment/MomentBritishEnglishLocaleTest.php @@ -10,12 +10,12 @@ class MomentBritishEnglishLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('en_GB'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -39,7 +39,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -68,7 +68,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $a = array( array('l, d F Y, G:i:s', 'Saturday, 12 June 2010, 22:00:00'), @@ -105,7 +105,7 @@ public function testFormat() // } // } - public function testOrdinalsFormat() + public function testOrdinalsFormat(): void { $moment = new Moment('2010-06-02T00:00:00+0000'); self::assertEquals('2nd', $moment->format('jS')); @@ -113,7 +113,7 @@ public function testOrdinalsFormat() self::assertEquals('12th', $moment->format('jS')); } - public function testRelative() + public function testRelative(): void { Moment::setLocale('en_GB'); diff --git a/tests/unit/Moment/MomentCanadianEnglishLocaleTest.php b/tests/unit/Moment/MomentCanadianEnglishLocaleTest.php index 80e2fb0..e28074d 100644 --- a/tests/unit/Moment/MomentCanadianEnglishLocaleTest.php +++ b/tests/unit/Moment/MomentCanadianEnglishLocaleTest.php @@ -19,12 +19,12 @@ class MomentCanadianEnglishLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('en_CA'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -48,7 +48,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -77,7 +77,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $a = array( array('l, d F Y, G:i:s', 'Saturday, 12 June 2010, 22:00:00'), @@ -93,7 +93,7 @@ public function testFormat() } } - public function testCustomLocaleFormat() + public function testCustomLocaleFormat(): void { $a = array( array('LT', '10:00 PM',), @@ -114,7 +114,7 @@ public function testCustomLocaleFormat() } } - public function testOrdinalsFormat() + public function testOrdinalsFormat(): void { $moment = new Moment('2010-06-02T00:00:00+0000'); self::assertEquals('2nd', $moment->format('jS')); @@ -122,7 +122,7 @@ public function testOrdinalsFormat() self::assertEquals('12th', $moment->format('jS')); } - public function testRelative() + public function testRelative(): void { $beginningMoment = new Moment('2010-06-12 00:00:00', 'Europe/London'); diff --git a/tests/unit/Moment/MomentCanadianFrenchLocaleTest.php b/tests/unit/Moment/MomentCanadianFrenchLocaleTest.php index a3440da..f2ccd57 100755 --- a/tests/unit/Moment/MomentCanadianFrenchLocaleTest.php +++ b/tests/unit/Moment/MomentCanadianFrenchLocaleTest.php @@ -18,12 +18,12 @@ class MomentCanadianFrenchLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('fr_CA'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -48,7 +48,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -78,7 +78,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $a = array( array('l, F d Y, g:i:s a', 'dimanche, février 14 2010, 3:25:50 pm'), @@ -94,7 +94,7 @@ public function testFormat() } } - public function testOrdinalsFormat() + public function testOrdinalsFormat(): void { $moment = new Moment('2010-06-02T00:00:00+0000'); self::assertEquals('2', $moment->format('jS')); @@ -102,7 +102,7 @@ public function testOrdinalsFormat() self::assertEquals('1er', $moment->format('jS')); } - public function testRelative() + public function testRelative(): void { $beginningMoment = new Moment('2015-06-14 20:46:22', 'Europe/Berlin'); $endMoment = new Moment('2015-06-14 20:48:32', 'Europe/Berlin'); diff --git a/tests/unit/Moment/MomentEsperantoLocaleTest.php b/tests/unit/Moment/MomentEsperantoLocaleTest.php index bdc6906..bdf2fac 100644 --- a/tests/unit/Moment/MomentEsperantoLocaleTest.php +++ b/tests/unit/Moment/MomentEsperantoLocaleTest.php @@ -6,12 +6,12 @@ class MomentEsperantoLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('eo'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -35,7 +35,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -64,7 +64,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $targetDate = new Moment('2010-06-09 15:25:50'); $formats = array( @@ -82,7 +82,7 @@ public function testFormat() } } - public function _testRelative() + public function _testRelative(): void { $beginningMoment = new Moment('2015-06-14 20:46:22', 'Europe/Berlin'); $endMoment = new Moment('2015-06-14 20:48:32', 'Europe/Berlin'); @@ -90,7 +90,7 @@ public function _testRelative() self::assertEquals('antaŭ 2 minutoj', $beginningMoment->from($endMoment)->getRelative()); } - public function testRelative() + public function testRelative(): void { $tz = 'Europe/Berlin'; $beginningMoment = new Moment('2010-06-12 00:00:00', $tz); diff --git a/tests/unit/Moment/MomentFrenchLocaleTest.php b/tests/unit/Moment/MomentFrenchLocaleTest.php index d6fbfae..2a7632f 100755 --- a/tests/unit/Moment/MomentFrenchLocaleTest.php +++ b/tests/unit/Moment/MomentFrenchLocaleTest.php @@ -6,12 +6,12 @@ class MomentFrenchLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('fr_FR'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -36,7 +36,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -66,7 +66,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $a = array( array('l, F d Y, g:i:s a', 'dimanche, février 14 2010, 3:25:50 pm'), @@ -82,7 +82,7 @@ public function testFormat() } } - public function testRelative() + public function testRelative(): void { $beginningMoment = new Moment('2015-06-14 20:46:22', 'Europe/Berlin'); $endMoment = new Moment('2015-06-14 20:48:32', 'Europe/Berlin'); diff --git a/tests/unit/Moment/MomentGermanLocaleTest.php b/tests/unit/Moment/MomentGermanLocaleTest.php index fa14136..dc47734 100755 --- a/tests/unit/Moment/MomentGermanLocaleTest.php +++ b/tests/unit/Moment/MomentGermanLocaleTest.php @@ -6,12 +6,12 @@ class MomentGermanLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('de_DE'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -36,7 +36,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -66,7 +66,7 @@ public function testMonthNames() } } - public function testHirbodIssueLocaleDate001() + public function testHirbodIssueLocaleDate001(): void { // @see: https://github.com/fightbulc/moment.php/issues/50 @@ -79,7 +79,7 @@ public function testHirbodIssueLocaleDate001() self::assertEquals('08. März', $moment->format('d. F')); } - public function testHirbodIssueLocaleDate002() + public function testHirbodIssueLocaleDate002(): void { // @see: https://github.com/fightbulc/moment.php/issues/61 @@ -87,7 +87,7 @@ public function testHirbodIssueLocaleDate002() self::assertEquals('03. Dezember', $moment->subtractMonths(1)->format('d. F')); } - public function testMonthsNominativeFallback() + public function testMonthsNominativeFallback(): void { $moment = new Moment('2016-01-03 16:17:07', 'Europe/Berlin'); self::assertEquals('Januar 2016', $moment->format('f Y')); diff --git a/tests/unit/Moment/MomentLatvianLocaleTest.php b/tests/unit/Moment/MomentLatvianLocaleTest.php index e6a1251..06819dd 100755 --- a/tests/unit/Moment/MomentLatvianLocaleTest.php +++ b/tests/unit/Moment/MomentLatvianLocaleTest.php @@ -6,12 +6,12 @@ class MomentLatvianLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('lv_LV'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2017-10-20T00:00:00+0000'; @@ -46,7 +46,7 @@ public function testWeekdayNames() } } - public function testMonthFormat() + public function testMonthFormat(): void { $startingDate = '2016-01-01T00:00:00+0000'; @@ -94,7 +94,7 @@ public function testMonthFormat() } } - public function testDayMonthFormat001() + public function testDayMonthFormat001(): void { $string = '2015-06-14 20:46:22'; $moment = new Moment($string, 'Europe/Riga'); @@ -105,7 +105,7 @@ public function testDayMonthFormat001() self::assertEquals('8 Martā', $moment->format('j F')); } - public function testMinutes() + public function testMinutes(): void { $past = new Moment('2016-01-03 16:17:07', 'Europe/Riga'); @@ -113,7 +113,7 @@ public function testMinutes() self::assertEquals('pirms 17 minūtēm', $relative->getRelative()); } - public function testShowRelativeCalendarDates() + public function testShowRelativeCalendarDates(): void { $past = new Moment('2016-04-10 16:30:07'); self::assertEquals('Pagājušā Svētdiena plkst. 16:30', $past->calendar(true, new Moment('2016-04-12'))); @@ -137,7 +137,7 @@ public function testShowRelativeCalendarDates() self::assertEquals('15.04.2116', $past->calendar(false, new Moment('2017-04-23'))); } - public function testFutureRelative() + public function testFutureRelative(): void { $date = new Moment('2017-01-11 01:00:00'); @@ -153,7 +153,7 @@ public function testFutureRelative() self::assertEquals('pēc 7 gadiem', $date->from('2010-01-11 00:00:00')->getRelative(), 'year'); } - public function testPastRelative() + public function testPastRelative(): void { $date = new Moment('2010-01-11 01:00:00'); self::assertEquals('pirms dažām sekundēm', $date->from('2010-01-11 01:00:01')->getRelative(), 'seconds'); @@ -168,7 +168,7 @@ public function testPastRelative() self::assertEquals('pirms 5 gadiem', $date->from('2015-01-11 01:00:00')->getRelative(), 'year'); } - public function testOrdinalFormat() + public function testOrdinalFormat(): void { $date = new Moment('2017-01-01 01:00:00', 'Europe/Riga'); self::assertEquals('1. Janvāris 2017', $date->format('jS f Y')); diff --git a/tests/unit/Moment/MomentPolishLocaleTest.php b/tests/unit/Moment/MomentPolishLocaleTest.php index aa0e9ad..88f7133 100755 --- a/tests/unit/Moment/MomentPolishLocaleTest.php +++ b/tests/unit/Moment/MomentPolishLocaleTest.php @@ -6,12 +6,12 @@ class MomentPolishLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('pl_PL'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2016-01-29T00:00:00+0000'; @@ -35,7 +35,7 @@ public function testWeekdayNames() } } - public function testDayMonthFormat001() + public function testDayMonthFormat001(): void { $string = '2015-06-14 20:46:22'; $moment = new Moment($string, 'Europe/Berlin'); @@ -46,13 +46,13 @@ public function testDayMonthFormat001() self::assertEquals('8 marca', $moment->format('j F')); } - public function testDayMonthFormat002() + public function testDayMonthFormat002(): void { $moment = new Moment('2016-01-03 16:17:07', 'Europe/Berlin'); self::assertEquals('3 grudnia', $moment->subtractMonths(1)->format('j F')); } - public function testMonthFormatFN() + public function testMonthFormatFN(): void { $startingDate = '2016-01-01T00:00:00+0000'; @@ -81,7 +81,7 @@ public function testMonthFormatFN() } - public function testMinutes() + public function testMinutes(): void { $past = new Moment('2016-01-03 16:17:07', 'Europe/Berlin'); @@ -95,7 +95,7 @@ public function testMinutes() self::assertEquals('13 minut temu', $relative->getRelative()); } - public function testLastWeekWeekend() + public function testLastWeekWeekend(): void { $past = new Moment('2016-04-10'); self::assertEquals('ostatnia niedziela', $past->calendar(false, new Moment('2016-04-12'))); diff --git a/tests/unit/Moment/MomentRussianLocaleTest.php b/tests/unit/Moment/MomentRussianLocaleTest.php index 5502244..dd6e5d2 100755 --- a/tests/unit/Moment/MomentRussianLocaleTest.php +++ b/tests/unit/Moment/MomentRussianLocaleTest.php @@ -6,12 +6,12 @@ class MomentRussianLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('ru_RU'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2016-01-29T00:00:00+0000'; @@ -35,7 +35,7 @@ public function testWeekdayNames() } } - public function testDayMonthFormat001() + public function testDayMonthFormat001(): void { $string = '2015-06-14 20:46:22'; $moment = new Moment($string, 'Europe/Moscow'); @@ -46,13 +46,13 @@ public function testDayMonthFormat001() self::assertEquals('8 марта', $moment->format('j F')); } - public function testDayMonthFormat002() + public function testDayMonthFormat002(): void { $moment = new Moment('2016-01-03 16:17:07', 'Europe/Moscow'); self::assertEquals('3 декабря', $moment->subtractMonths(1)->format('j F')); } - public function testMonthFormatFN() + public function testMonthFormatFN(): void { $startingDate = '2016-01-01T00:00:00+0000'; @@ -81,7 +81,7 @@ public function testMonthFormatFN() } - public function testMinutes() + public function testMinutes(): void { $past = new Moment('2016-01-03 16:17:07', 'Europe/Moscow'); @@ -95,7 +95,7 @@ public function testMinutes() self::assertEquals('13 минут назад', $relative->getRelative()); } - public function testSeconds() + public function testSeconds(): void { $past = new Moment('2017-08-30 20:49:30', 'Europe/Samara'); @@ -109,7 +109,7 @@ public function testSeconds() self::assertEquals('5 секунд назад', $relative->getRelative()); } - public function testLastWeekWeekend() + public function testLastWeekWeekend(): void { $past = new Moment('2016-04-10 16:30:07'); self::assertEquals('воскресенье в 16:30', $past->calendar(true, new Moment('2016-04-12'))); @@ -136,7 +136,7 @@ public function testLastWeekWeekend() self::assertEquals('суббота', $past->calendar(false, new Moment('2016-04-18'))); } - public function testFutureRelative() + public function testFutureRelative(): void { $date = new Moment('2017-01-11 01:00:00'); @@ -150,7 +150,7 @@ public function testFutureRelative() } - public function testOrdinalFormat() + public function testOrdinalFormat(): void { $date = new Moment('2017-01-01 01:00:00'); self::assertEquals('1е января 2017', $date->format('jS F Y')); diff --git a/tests/unit/Moment/MomentSimilarLocaleTest.php b/tests/unit/Moment/MomentSimilarLocaleTest.php index 08fd3d5..4b84f98 100755 --- a/tests/unit/Moment/MomentSimilarLocaleTest.php +++ b/tests/unit/Moment/MomentSimilarLocaleTest.php @@ -7,7 +7,7 @@ class MomentSimilarLocaleTest extends MomentBritishEnglishLocaleTest /** * @throws MomentException */ - public function setUp() + public function setUp(): void { Moment::setLocale('en', true); } diff --git a/tests/unit/Moment/MomentTurkishLocaleTest.php b/tests/unit/Moment/MomentTurkishLocaleTest.php index 5844f98..f73640e 100755 --- a/tests/unit/Moment/MomentTurkishLocaleTest.php +++ b/tests/unit/Moment/MomentTurkishLocaleTest.php @@ -11,12 +11,12 @@ class MomentTurkishLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('tr_TR'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -39,7 +39,7 @@ public function testWeekdayNames() } } - public function testMonthNames() + public function testMonthNames(): void { $startingDate = '2015-01-04T00:00:00+0000'; @@ -68,7 +68,7 @@ public function testMonthNames() } } - public function testFormat() + public function testFormat(): void { $a = array( array('l, F d Y, g:i:s a', 'Pazar, Şubat 14 2010, 3:25:50 pm'), @@ -84,7 +84,7 @@ public function testFormat() } } - public function testRelative() + public function testRelative(): void { $beginningMoment = new Moment('2015-06-14 20:46:22', 'Europe/Istanbul'); $endMoment = new Moment('2015-06-14 20:48:32', 'Europe/Istanbul'); @@ -92,7 +92,7 @@ public function testRelative() self::assertEquals('2 dakika önce', $beginningMoment->from($endMoment)->getRelative()); } - public function testMinutes() + public function testMinutes(): void { $past = new Moment('2016-01-03 16:17:07', 'Europe/Kiev'); @@ -106,7 +106,7 @@ public function testMinutes() self::assertEquals('13 dakika önce', $relative->getRelative()); } - public function testLastWeekWeekend() + public function testLastWeekWeekend(): void { $past = new Moment('2016-04-10 16:30:07'); self::assertEquals('Geçen hafta Pazar 16:30', $past->calendar(true, new Moment('2016-04-12'))); diff --git a/tests/unit/Moment/MomentUkrainianLocaleTest.php b/tests/unit/Moment/MomentUkrainianLocaleTest.php index 79daf6c..34b7b41 100755 --- a/tests/unit/Moment/MomentUkrainianLocaleTest.php +++ b/tests/unit/Moment/MomentUkrainianLocaleTest.php @@ -6,12 +6,12 @@ class MomentUkrainianLocaleTest extends TestCase { - public function setUp() + public function setUp(): void { Moment::setLocale('uk_UA'); } - public function testWeekdayNames() + public function testWeekdayNames(): void { $startingDate = '2016-01-29T00:00:00+0000'; @@ -35,7 +35,7 @@ public function testWeekdayNames() } } - public function testDayMonthFormat001() + public function testDayMonthFormat001(): void { $string = '2015-06-14 20:46:22'; $moment = new Moment($string, 'Europe/Kiev'); @@ -46,13 +46,13 @@ public function testDayMonthFormat001() self::assertEquals('8 березня', $moment->format('j F')); } - public function testDayMonthFormat002() + public function testDayMonthFormat002(): void { $moment = new Moment('2016-01-03 16:17:07', 'Europe/Kiev'); self::assertEquals('3 грудня', $moment->subtractMonths(1)->format('j F')); } - public function testMonthFormatFN() + public function testMonthFormatFN(): void { $startingDate = '2016-01-01T00:00:00+0000'; @@ -81,7 +81,7 @@ public function testMonthFormatFN() } - public function testMinutes() + public function testMinutes(): void { $past = new Moment('2016-01-03 16:17:07', 'Europe/Kiev'); @@ -95,7 +95,7 @@ public function testMinutes() self::assertEquals('13 хвилин тому', $relative->getRelative()); } - public function testLastWeekWeekend() + public function testLastWeekWeekend(): void { $past = new Moment('2016-04-10 16:30:07'); self::assertEquals('неділя о 16:30', $past->calendar(true, new Moment('2016-04-12')));