From cc6e0457e97bd22085ce10e5143c6ab7b5d97a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Glavi=C4=87?= Date: Tue, 13 Feb 2018 21:48:20 +0100 Subject: [PATCH] travisci and styleci configuration upgrade (#1087) * Updated .travis for php 7.2 * Replaced Carbon arguments to self. * Updated travis configuration. * Missed one Carbon argument. * Updated phpstan version in travis. * Removed phpstan and coverage for the time being. * Minor modification to php versions. * Fixed phpstan errors. * Added php v7.2 (lowest) to allow_failure. * Minor bug in .travis.yml file :/ * Minor bug in .travis.yml file :/ * Trying to handle phpunit bug. * Travis fix. Tnx to: https://github.com/CarbonDate/Carbon/blob/1aeda6559fd581a9d9802f5b1eaed38a8b29a935/.travis.yml#L33 * Modified file for PHP-CS-fixer to work. * Tests fix for issue #1045. --- .gitignore | 2 + .php_cs.dist | 5 +- .travis.yml | 53 +++++++++------ phpstan.neon | 9 +-- src/Carbon/Carbon.php | 82 +++++++++++------------ src/Carbon/CarbonInterval.php | 30 ++++----- src/Carbon/Lang/bg.php | 2 +- tests/Carbon/AddMonthsTest.php | 32 ++++----- tests/Carbon/ExpressiveComparisonTest.php | 39 ++++------- tests/Localization/UkTest.php | 28 ++++---- 10 files changed, 144 insertions(+), 138 deletions(-) diff --git a/.gitignore b/.gitignore index 07eecf5400..490ae2d190 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ .idea +.vscode *.iml .php_cs .php_cs.cache vendor composer.phar composer.lock +coverage.xml phpunit.xml diff --git a/.php_cs.dist b/.php_cs.dist index ff8b56f0a6..bb8d08696c 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -49,9 +49,12 @@ $rules = [ 'trailing_comma_in_multiline_array' => true, 'trim_array_spaces' => true, 'unary_operator_spaces' => true, + 'line_ending' => true, + 'blank_line_after_namespace' => true, + 'no_unused_imports' => true, ]; return Config::create()->setRules($rules) ->setFinder(Finder::create()->in(__DIR__)) ->setUsingCache(true) - ->setRiskyAllowed(true); \ No newline at end of file + ->setRiskyAllowed(true); diff --git a/.travis.yml b/.travis.yml index a2663eb532..7113466737 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,34 +4,30 @@ cache: directories: - $HOME/.composer/cache -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - hhvm - env: global: + - setup=basic - coverage=false - phpstan=false - - setup=basic sudo: false before_install: - - if [[ $TRAVIS_PHP_VERSION != 7.1 && $TRAVIS_PHP_VERSION != 'hhvm' && $coverage = 'false' ]]; then phpenv config-rm xdebug.ini; fi + - if [[ $coverage = 'false' ]]; then phpenv config-rm xdebug.ini; fi install: - - if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest; fi + - if [[ $phpstan = 'true' ]]; then travis_retry composer require --dev phpstan/phpstan; fi + - if [[ $setup = 'basic' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest; fi - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi - - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest; fi + - | + if [[ $setup = 'lowest' ]]; then + composer require sebastian/comparator:"~1.2.4" --no-update --dev + travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest + fi script: - vendor/bin/phpunit --verbose --coverage-clover=coverage.xml - - if [[ $phpstan = 'true' ]]; then travis_retry composer require --dev phpstan/phpstan:^0.6 && vendor/bin/phpstan analyse --configuration phpstan.neon --level 3 src tests; fi + - if [[ $phpstan = 'true' ]]; then vendor/bin/phpstan analyse --configuration phpstan.neon --level 3 src tests; fi after_success: - if [[ $coverage = 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi @@ -39,34 +35,51 @@ after_success: matrix: include: - php: 5.3 + dist: precise + - php: 5.3 + dist: precise env: setup=lowest - php: 5.3 + dist: precise env: setup=stable + + - php: 5.4 - php: 5.4 env: setup=lowest - php: 5.4 env: setup=stable + + - php: 5.5 - php: 5.5 env: setup=lowest - php: 5.5 env: setup=stable + + - php: 5.6 - php: 5.6 env: setup=lowest - php: 5.6 env: setup=stable + + - php: 7.0 - php: 7.0 env: setup=lowest - php: 7.0 - env: - - phpstan=true - - setup=stable + env: setup=stable + + - php: 7.1 - php: 7.1 env: setup=lowest - php: 7.1 + env: setup=stable + + - php: 7.2 env: - coverage=true - phpstan=true - - setup=stable - allow_failures: - - php: hhvm + - php: 7.2 + env: setup=lowest + - php: 7.2 + env: setup=stable + fast_finish: true diff --git a/phpstan.neon b/phpstan.neon index 3a720bf41e..02c05d7a78 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,7 @@ parameters: ignoreErrors: - - '#Access to an undefined property Carbon\\Carbon::\$doesNotExit#' - - '#Call to an undefined static method Carbon\\CarbonInterval#' - - '#Property Carbon\\Carbon::\$timezone \(DateTimeZone\) does not accept string#' - - '#Property Carbon\\Carbon::\$tz \(DateTimeZone\) does not accept string#' + - '#Static call to instance method Carbon\\CarbonInterval::#' + excludes_analyse: + - '*/tests/Carbon/SettersTest.php' + - '*/tests/Carbon/GettersTest.php' + - '*/tests/CarbonInterval/GettersTest.php' diff --git a/src/Carbon/Carbon.php b/src/Carbon/Carbon.php index ea1fde1ec0..d6ae022d70 100644 --- a/src/Carbon/Carbon.php +++ b/src/Carbon/Carbon.php @@ -973,7 +973,7 @@ public static function getWeekStartsAt() /** * Set the first day of week * - * @param int + * @param int $day */ public static function setWeekStartsAt($day) { @@ -993,7 +993,7 @@ public static function getWeekEndsAt() /** * Set the last day of week * - * @param int + * @param int $day */ public static function setWeekEndsAt($day) { @@ -1013,7 +1013,7 @@ public static function getWeekendDays() /** * Set weekend days * - * @param array + * @param array $days */ public static function setWeekendDays($days) { @@ -1403,7 +1403,7 @@ public function toW3cString() * * @return bool */ - public function eq(Carbon $dt) + public function eq(self $dt) { return $this == $dt; } @@ -1417,7 +1417,7 @@ public function eq(Carbon $dt) * * @return bool */ - public function equalTo(Carbon $dt) + public function equalTo(self $dt) { return $this->eq($dt); } @@ -1429,7 +1429,7 @@ public function equalTo(Carbon $dt) * * @return bool */ - public function ne(Carbon $dt) + public function ne(self $dt) { return !$this->eq($dt); } @@ -1443,7 +1443,7 @@ public function ne(Carbon $dt) * * @return bool */ - public function notEqualTo(Carbon $dt) + public function notEqualTo(self $dt) { return $this->ne($dt); } @@ -1455,7 +1455,7 @@ public function notEqualTo(Carbon $dt) * * @return bool */ - public function gt(Carbon $dt) + public function gt(self $dt) { return $this > $dt; } @@ -1469,7 +1469,7 @@ public function gt(Carbon $dt) * * @return bool */ - public function greaterThan(Carbon $dt) + public function greaterThan(self $dt) { return $this->gt($dt); } @@ -1481,7 +1481,7 @@ public function greaterThan(Carbon $dt) * * @return bool */ - public function gte(Carbon $dt) + public function gte(self $dt) { return $this >= $dt; } @@ -1495,7 +1495,7 @@ public function gte(Carbon $dt) * * @return bool */ - public function greaterThanOrEqualTo(Carbon $dt) + public function greaterThanOrEqualTo(self $dt) { return $this->gte($dt); } @@ -1507,7 +1507,7 @@ public function greaterThanOrEqualTo(Carbon $dt) * * @return bool */ - public function lt(Carbon $dt) + public function lt(self $dt) { return $this < $dt; } @@ -1521,7 +1521,7 @@ public function lt(Carbon $dt) * * @return bool */ - public function lessThan(Carbon $dt) + public function lessThan(self $dt) { return $this->lt($dt); } @@ -1533,7 +1533,7 @@ public function lessThan(Carbon $dt) * * @return bool */ - public function lte(Carbon $dt) + public function lte(self $dt) { return $this <= $dt; } @@ -1547,7 +1547,7 @@ public function lte(Carbon $dt) * * @return bool */ - public function lessThanOrEqualTo(Carbon $dt) + public function lessThanOrEqualTo(self $dt) { return $this->lte($dt); } @@ -1561,7 +1561,7 @@ public function lessThanOrEqualTo(Carbon $dt) * * @return bool */ - public function between(Carbon $dt1, Carbon $dt2, $equal = true) + public function between(self $dt1, self $dt2, $equal = true) { if ($dt1->gt($dt2)) { $temp = $dt1; @@ -1584,7 +1584,7 @@ public function between(Carbon $dt1, Carbon $dt2, $equal = true) * * @return static */ - public function closest(Carbon $dt1, Carbon $dt2) + public function closest(self $dt1, self $dt2) { return $this->diffInSeconds($dt1) < $this->diffInSeconds($dt2) ? $dt1 : $dt2; } @@ -1597,7 +1597,7 @@ public function closest(Carbon $dt1, Carbon $dt2) * * @return static */ - public function farthest(Carbon $dt1, Carbon $dt2) + public function farthest(self $dt1, self $dt2) { return $this->diffInSeconds($dt1) > $this->diffInSeconds($dt2) ? $dt1 : $dt2; } @@ -1609,7 +1609,7 @@ public function farthest(Carbon $dt1, Carbon $dt2) * * @return static */ - public function min(Carbon $dt = null) + public function min(self $dt = null) { $dt = $dt ?: static::now($this->getTimezone()); @@ -1625,7 +1625,7 @@ public function min(Carbon $dt = null) * * @return static */ - public function minimum(Carbon $dt = null) + public function minimum(self $dt = null) { return $this->min($dt); } @@ -1637,7 +1637,7 @@ public function minimum(Carbon $dt = null) * * @return static */ - public function max(Carbon $dt = null) + public function max(self $dt = null) { $dt = $dt ?: static::now($this->getTimezone()); @@ -1653,7 +1653,7 @@ public function max(Carbon $dt = null) * * @return static */ - public function maximum(Carbon $dt = null) + public function maximum(self $dt = null) { return $this->max($dt); } @@ -1818,7 +1818,7 @@ public function isLongYear() * * @return bool */ - public function isSameAs($format, Carbon $dt = null) + public function isSameAs($format, self $dt = null) { $dt = $dt ?: static::now($this->tz); @@ -1842,7 +1842,7 @@ public function isCurrentYear() * * @return bool */ - public function isSameYear(Carbon $dt = null) + public function isSameYear(self $dt = null) { return $this->isSameAs('Y', $dt); } @@ -1865,7 +1865,7 @@ public function isCurrentMonth() * * @return bool */ - public function isSameMonth(Carbon $dt = null, $ofSameYear = false) + public function isSameMonth(self $dt = null, $ofSameYear = false) { $format = $ofSameYear ? 'Y-m' : 'm'; @@ -1879,7 +1879,7 @@ public function isSameMonth(Carbon $dt = null, $ofSameYear = false) * * @return bool */ - public function isSameDay(Carbon $dt) + public function isSameDay(self $dt) { return $this->toDateString() === $dt->toDateString(); } @@ -2574,7 +2574,7 @@ public function subSeconds($value) * * @return int */ - public function diffInYears(Carbon $dt = null, $abs = true) + public function diffInYears(self $dt = null, $abs = true) { $dt = $dt ?: static::now($this->getTimezone()); @@ -2589,7 +2589,7 @@ public function diffInYears(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInMonths(Carbon $dt = null, $abs = true) + public function diffInMonths(self $dt = null, $abs = true) { $dt = $dt ?: static::now($this->getTimezone()); @@ -2604,7 +2604,7 @@ public function diffInMonths(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInWeeks(Carbon $dt = null, $abs = true) + public function diffInWeeks(self $dt = null, $abs = true) { return (int) ($this->diffInDays($dt, $abs) / static::DAYS_PER_WEEK); } @@ -2617,7 +2617,7 @@ public function diffInWeeks(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInDays(Carbon $dt = null, $abs = true) + public function diffInDays(self $dt = null, $abs = true) { $dt = $dt ?: static::now($this->getTimezone()); @@ -2633,7 +2633,7 @@ public function diffInDays(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInDaysFiltered(Closure $callback, Carbon $dt = null, $abs = true) + public function diffInDaysFiltered(Closure $callback, self $dt = null, $abs = true) { return $this->diffFiltered(CarbonInterval::day(), $callback, $dt, $abs); } @@ -2647,7 +2647,7 @@ public function diffInDaysFiltered(Closure $callback, Carbon $dt = null, $abs = * * @return int */ - public function diffInHoursFiltered(Closure $callback, Carbon $dt = null, $abs = true) + public function diffInHoursFiltered(Closure $callback, self $dt = null, $abs = true) { return $this->diffFiltered(CarbonInterval::hour(), $callback, $dt, $abs); } @@ -2662,7 +2662,7 @@ public function diffInHoursFiltered(Closure $callback, Carbon $dt = null, $abs = * * @return int */ - public function diffFiltered(CarbonInterval $ci, Closure $callback, Carbon $dt = null, $abs = true) + public function diffFiltered(CarbonInterval $ci, Closure $callback, self $dt = null, $abs = true) { $start = $this; $end = $dt ?: static::now($this->getTimezone()); @@ -2692,7 +2692,7 @@ public function diffFiltered(CarbonInterval $ci, Closure $callback, Carbon $dt = * * @return int */ - public function diffInWeekdays(Carbon $dt = null, $abs = true) + public function diffInWeekdays(self $dt = null, $abs = true) { return $this->diffInDaysFiltered(function (Carbon $date) { return $date->isWeekday(); @@ -2707,7 +2707,7 @@ public function diffInWeekdays(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInWeekendDays(Carbon $dt = null, $abs = true) + public function diffInWeekendDays(self $dt = null, $abs = true) { return $this->diffInDaysFiltered(function (Carbon $date) { return $date->isWeekend(); @@ -2722,7 +2722,7 @@ public function diffInWeekendDays(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInHours(Carbon $dt = null, $abs = true) + public function diffInHours(self $dt = null, $abs = true) { return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); } @@ -2735,7 +2735,7 @@ public function diffInHours(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInMinutes(Carbon $dt = null, $abs = true) + public function diffInMinutes(self $dt = null, $abs = true) { return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE); } @@ -2748,7 +2748,7 @@ public function diffInMinutes(Carbon $dt = null, $abs = true) * * @return int */ - public function diffInSeconds(Carbon $dt = null, $abs = true) + public function diffInSeconds(self $dt = null, $abs = true) { $dt = $dt ?: static::now($this->getTimezone()); $value = $dt->getTimestamp() - $this->getTimestamp(); @@ -2801,7 +2801,7 @@ public function secondsUntilEndOfDay() * * @return string */ - public function diffForHumans(Carbon $other = null, $absolute = false, $short = false) + public function diffForHumans(self $other = null, $absolute = false, $short = false) { $isNow = $other === null; @@ -3298,7 +3298,7 @@ public function nthOfYear($nth, $dayOfWeek) * * @return static */ - public function average(Carbon $dt = null) + public function average(self $dt = null) { $dt = $dt ?: static::now($this->getTimezone()); @@ -3312,7 +3312,7 @@ public function average(Carbon $dt = null) * * @return bool */ - public function isBirthday(Carbon $dt = null) + public function isBirthday(self $dt = null) { return $this->isSameAs('md', $dt); } diff --git a/src/Carbon/CarbonInterval.php b/src/Carbon/CarbonInterval.php index 00db22a875..850aec6640 100644 --- a/src/Carbon/CarbonInterval.php +++ b/src/Carbon/CarbonInterval.php @@ -47,21 +47,21 @@ * @method static CarbonInterval minute($minutes = 1) Alias for minutes() * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds. * @method static CarbonInterval second($seconds = 1) Alias for seconds() - * @method CarbonInterval years() years($years = 1) Set the years portion of the current interval. - * @method CarbonInterval year() year($years = 1) Alias for years(). - * @method CarbonInterval months() months($months = 1) Set the months portion of the current interval. - * @method CarbonInterval month() month($months = 1) Alias for months(). - * @method CarbonInterval weeks() weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. - * @method CarbonInterval week() week($weeks = 1) Alias for weeks(). - * @method CarbonInterval days() days($days = 1) Set the days portion of the current interval. - * @method CarbonInterval dayz() dayz($days = 1) Alias for days(). - * @method CarbonInterval day() day($days = 1) Alias for days(). - * @method CarbonInterval hours() hours($hours = 1) Set the hours portion of the current interval. - * @method CarbonInterval hour() hour($hours = 1) Alias for hours(). - * @method CarbonInterval minutes() minutes($minutes = 1) Set the minutes portion of the current interval. - * @method CarbonInterval minute() minute($minutes = 1) Alias for minutes(). - * @method CarbonInterval seconds() seconds($seconds = 1) Set the seconds portion of the current interval. - * @method CarbonInterval second() second($seconds = 1) Alias for seconds(). + * @method CarbonInterval years($years = 1) Set the years portion of the current interval. + * @method CarbonInterval year($years = 1) Alias for years(). + * @method CarbonInterval months($months = 1) Set the months portion of the current interval. + * @method CarbonInterval month($months = 1) Alias for months(). + * @method CarbonInterval weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. + * @method CarbonInterval week($weeks = 1) Alias for weeks(). + * @method CarbonInterval days($days = 1) Set the days portion of the current interval. + * @method CarbonInterval dayz($days = 1) Alias for days(). + * @method CarbonInterval day($days = 1) Alias for days(). + * @method CarbonInterval hours($hours = 1) Set the hours portion of the current interval. + * @method CarbonInterval hour($hours = 1) Alias for hours(). + * @method CarbonInterval minutes($minutes = 1) Set the minutes portion of the current interval. + * @method CarbonInterval minute($minutes = 1) Alias for minutes(). + * @method CarbonInterval seconds($seconds = 1) Set the seconds portion of the current interval. + * @method CarbonInterval second($seconds = 1) Alias for seconds(). */ class CarbonInterval extends DateInterval { diff --git a/src/Carbon/Lang/bg.php b/src/Carbon/Lang/bg.php index 309934b504..aff95a0e68 100644 --- a/src/Carbon/Lang/bg.php +++ b/src/Carbon/Lang/bg.php @@ -21,7 +21,7 @@ 'hour' => '1 час|:count часа', 'h' => '1 час|:count часа', 'minute' => '1 минута|:count минути', - 'm' => '1 минута|:count минути', + 'min' => '1 минута|:count минути', 'second' => '1 секунда|:count секунди', 's' => '1 секунда|:count секунди', 'ago' => 'преди :time', diff --git a/tests/Carbon/AddMonthsTest.php b/tests/Carbon/AddMonthsTest.php index c7e5c9b3b4..0a6784fb57 100644 --- a/tests/Carbon/AddMonthsTest.php +++ b/tests/Carbon/AddMonthsTest.php @@ -42,7 +42,7 @@ public function providerTestAddMonthNoOverflow() /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -55,7 +55,7 @@ public function testAddMonthNoOverflow($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -79,7 +79,7 @@ public function providerTestSubMonthNoOverflow() /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -92,7 +92,7 @@ public function testSubMonthNoOverflow($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -116,7 +116,7 @@ public function providerTestAddMonthWithOverflow() /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -129,7 +129,7 @@ public function testAddMonthWithOverflow($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -153,7 +153,7 @@ public function providerTestSubMonthWithOverflow() /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -166,7 +166,7 @@ public function testSubMonthWithOverflow($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -205,7 +205,7 @@ public function testSetOverflowIsReset() /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -219,7 +219,7 @@ public function testUseOverflowAddMonth($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -233,7 +233,7 @@ public function testUseOverflowAddMonths($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -247,7 +247,7 @@ public function testUseOverflowSubMonth($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -261,7 +261,7 @@ public function testUseOverflowSubMonths($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -275,7 +275,7 @@ public function testSkipOverflowAddMonth($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -289,7 +289,7 @@ public function testSkipOverflowAddMonths($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d @@ -303,7 +303,7 @@ public function testSkipOverflowSubMonth($months, $y, $m, $d) /** * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow * - * @param $months + * @param int $months * @param int $y * @param int $m * @param int $d diff --git a/tests/Carbon/ExpressiveComparisonTest.php b/tests/Carbon/ExpressiveComparisonTest.php index fc4a0f1b70..e0f5da679e 100644 --- a/tests/Carbon/ExpressiveComparisonTest.php +++ b/tests/Carbon/ExpressiveComparisonTest.php @@ -28,14 +28,12 @@ public function testEqualToFalse() public function testEqualWithTimezoneTrue() { - $this->assertTrue(Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto')->equalTo(Carbon::create(2000, 1, 1, 9, - 0, 0, 'America/Vancouver'))); + $this->assertTrue(Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto')->equalTo(Carbon::create(2000, 1, 1, 9, 0, 0, 'America/Vancouver'))); } public function testEqualWithTimezoneFalse() { - $this->assertFalse(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->equalTo(Carbon::createFromDate(2000, - 1, 1, 'America/Vancouver'))); + $this->assertFalse(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->equalTo(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver'))); } public function testNotEqualToTrue() @@ -50,8 +48,7 @@ public function testNotEqualToFalse() public function testNotEqualWithTimezone() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->notEqualTo(Carbon::createFromDate(2000, - 1, 1, 'America/Vancouver'))); + $this->assertTrue(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->notEqualTo(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver'))); } public function testGreaterThanTrue() @@ -80,8 +77,7 @@ public function testGreaterThanWithTimezoneFalse() public function testGreaterThanOrEqualTrue() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(1999, 12, - 31))); + $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(1999, 12, 31))); } public function testGreaterThanOrEqualTrueEqual() @@ -91,8 +87,7 @@ public function testGreaterThanOrEqualTrueEqual() public function testGreaterThanOrEqualFalse() { - $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(2000, 1, - 2))); + $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(2000, 1, 2))); } public function testLessThanTrue() @@ -122,50 +117,42 @@ public function testLessThanOrEqualFalse() public function testBetweenEqualTrue() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), - Carbon::createFromDate(2000, 1, 31), true)); + $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true)); } public function testBetweenNotEqualTrue() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), - Carbon::createFromDate(2000, 1, 31), false)); + $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false)); } public function testBetweenEqualFalse() { - $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 1), - Carbon::createFromDate(2000, 1, 31), true)); + $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true)); } public function testBetweenNotEqualFalse() { - $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 1), - Carbon::createFromDate(2000, 1, 31), false)); + $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false)); } public function testBetweenEqualSwitchTrue() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), - Carbon::createFromDate(2000, 1, 1), true)); + $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true)); } public function testBetweenNotEqualSwitchTrue() { - $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), - Carbon::createFromDate(2000, 1, 1), false)); + $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false)); } public function testBetweenEqualSwitchFalse() { - $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 31), - Carbon::createFromDate(2000, 1, 1), true)); + $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true)); } public function testBetweenNotEqualSwitchFalse() { - $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 31), - Carbon::createFromDate(2000, 1, 1), false)); + $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false)); } public function testMinIsFluid() diff --git a/tests/Localization/UkTest.php b/tests/Localization/UkTest.php index 6696738d88..318ff0c286 100644 --- a/tests/Localization/UkTest.php +++ b/tests/Localization/UkTest.php @@ -23,46 +23,46 @@ public function testDiffForHumansUsingShortUnitsUkrainian() $scope = $this; $this->wrapWithNonDstDate(function () use ($scope) { $d = Carbon::now()->subSecond(); - $scope->assertSame('1 секунду назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 секунду тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subSeconds(2); - $scope->assertSame('2 секунди назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 секунди тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subMinute(); - $scope->assertSame('1 хвилину назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 хвилину тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subMinutes(2); - $scope->assertSame('2 хвилини назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 хвилини тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subHour(); - $scope->assertSame('1 година назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 година тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subHours(2); - $scope->assertSame('2 години назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 години тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subDay(); - $scope->assertSame('1 день назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 день тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subDays(2); - $scope->assertSame('2 дні назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 дні тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subWeek(); - $scope->assertSame('1 тиждень назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 тиждень тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subWeeks(2); - $scope->assertSame('2 тижні назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 тижні тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subMonth(); - $scope->assertSame('1 місяць назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 місяць тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subMonths(2); - $scope->assertSame('2 місяці назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 місяці тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subYear(); - $scope->assertSame('1 рік назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('1 рік тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->subYears(2); - $scope->assertSame('2 роки назад', $d->diffForHumans(null, false, true)); + $scope->assertSame('2 роки тому', $d->diffForHumans(null, false, true)); $d = Carbon::now()->addSecond(); $scope->assertSame('через 1 секунду', $d->diffForHumans(null, false, true));