From a8fecb409714feb4c47dc088e3335e5b952e38d5 Mon Sep 17 00:00:00 2001
From: KyleKatarn
Date: Sat, 25 Nov 2023 17:41:03 +0100
Subject: [PATCH] Always use LF in auto-generated files
---
docs/index.html | 78 +++++++++++------------
index.html | 3 +
reference/index.html | 132 +++++++++++++++++++--------------------
tools/api-history.php | 11 ++--
tools/cache-releases.php | 4 +-
tools/functions.php | 16 +++++
tools/generate.php | 13 ++--
tools/release.php | 4 +-
8 files changed, 143 insertions(+), 118 deletions(-)
create mode 100644 tools/functions.php
diff --git a/docs/index.html b/docs/index.html
index 9dbbd10d1a..d5e8807dd6 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -133,13 +133,13 @@ Introduction
$modifiedImmutable = CarbonImmutable::now()->add(1, 'day');
var_dump($modifiedMutable === $mutable); // bool(true)
-var_dump($mutable->isoFormat('dddd D')); // string(11) "Thursday 23"
-var_dump($modifiedMutable->isoFormat('dddd D')); // string(11) "Thursday 23"
+var_dump($mutable->isoFormat('dddd D')); // string(9) "Sunday 26"
+var_dump($modifiedMutable->isoFormat('dddd D')); // string(9) "Sunday 26"
// So it means $mutable and $modifiedMutable are the same object
// both set to now + 1 day.
var_dump($modifiedImmutable === $immutable); // bool(false)
-var_dump($immutable->isoFormat('dddd D')); // string(12) "Wednesday 22"
-var_dump($modifiedImmutable->isoFormat('dddd D')); // string(11) "Thursday 23"
+var_dump($immutable->isoFormat('dddd D')); // string(11) "Saturday 25"
+var_dump($modifiedImmutable->isoFormat('dddd D')); // string(9) "Sunday 26"
// While $immutable is still set to now and cannot be changed and
// $modifiedImmutable is a new instance created from $immutable
// set to now + 1 day.
@@ -281,16 +281,16 @@ Instantiation
$now = Carbon::now();
-echo $now; // 2023-11-22 14:37:23
+echo $now; // 2023-11-25 13:42:56
echo "\n";
$today = Carbon::today();
-echo $today; // 2023-11-22 00:00:00
+echo $today; // 2023-11-25 00:00:00
echo "\n";
$tomorrow = Carbon::tomorrow('Europe/London');
-echo $tomorrow; // 2023-11-23 00:00:00
+echo $tomorrow; // 2023-11-26 00:00:00
echo "\n";
$yesterday = Carbon::yesterday();
-echo $yesterday; // 2023-11-21 00:00:00
+echo $yesterday; // 2023-11-24 00:00:00
@@ -451,7 +451,7 @@ Instantiation
// 19:15 in Johannesburg
echo 'Meeting starts at '.$meeting->format('H:i').' in Johannesburg.'; // Meeting starts at 19:15 in Johannesburg.
// now in Johannesburg
-echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 16:37 right now in Johannesburg.
+echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 15:42 right now in Johannesburg.
@@ -805,7 +805,7 @@ Localization
echo "\n";
echo $date->monthName; // novembre
echo "\n";
-echo $date->isoFormat('LLLL'); // mercredi 22 novembre 2023 14:37
+echo $date->isoFormat('LLLL'); // samedi 25 novembre 2023 13:42
@@ -836,13 +836,13 @@ Localization
echo $toDisplay;
/*
15 juin 2018 14:34
-Aujourd’hui à 15:37
+Aujourd’hui à 14:42
*/
echo $notificationForJohn;
/*
Jun 15, 2018 7:34 AM
-Today at 8:37 AM
+Today at 7:42 AM
*/
@@ -869,9 +869,9 @@ Localization
]);
// Important note: timezone setting calls ->shiftTimezone() and not ->setTimezone(),
// It means it does not just set the timezone, but shift the time too:
-echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 22/11 9h Asia/Tokyo
+echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 25/11 9h Asia/Tokyo
echo "\n";
-echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 22/11 0h Asia/Tokyo
+echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 25/11 0h Asia/Tokyo
@@ -1751,21 +1751,21 @@ Localization
$date = CarbonImmutable::now();
-echo $date->calendar(); // Today at 2:37 PM
+echo $date->calendar(); // Today at 1:42 PM
echo "\n";
-echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 11:37 AM
+echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 10:42 AM
echo "\n";
-echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Sunday at 4:14 AM
+echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Wednesday at 3:19 AM
echo "\n";
-echo $date->sub('8 days')->calendar(); // 11/14/2023
+echo $date->sub('8 days')->calendar(); // 11/17/2023
echo "\n";
-echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 5:37 PM
+echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 4:42 PM
echo "\n";
-echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Sunday at 1:00 AM
+echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Wednesday at 12:05 AM
echo "\n";
-echo $date->add('8 days')->calendar(); // 11/30/2023
+echo $date->add('8 days')->calendar(); // 12/03/2023
echo "\n";
-echo $date->locale('fr')->calendar(); // Aujourd’hui à 14:37
+echo $date->locale('fr')->calendar(); // Aujourd’hui à 13:42
@@ -5660,7 +5660,7 @@ Testing Aids
var_dump(Carbon::hasTestNow()); // bool(true)
Carbon::setTestNow(); // clear the mock
var_dump(Carbon::hasTestNow()); // bool(false)
-echo Carbon::now(); // 2023-11-22 14:37:24
+echo Carbon::now(); // 2023-11-25 13:42:57
// Instead of mock and clear mock, you also can use withTestNow():
Carbon::withTestNow('2010-09-15', static function () {
@@ -5867,7 +5867,7 @@ Getters
// Returns timezone as CarbonTimeZone
var_dump(Carbon::createFromTimestamp(0, 'Europe/Paris')->getTimezone());
-/* object(Carbon\CarbonTimeZone)#1474 (2) {
+/* object(Carbon\CarbonTimeZone)#9955 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
@@ -5910,12 +5910,12 @@ Getters
// You can get any property dynamically too:
$unit = 'second';
-var_dump(Carbon::now()->get($unit)); // int(24)
+var_dump(Carbon::now()->get($unit)); // int(57)
// equivalent to:
-var_dump(Carbon::now()->$unit); // int(24)
+var_dump(Carbon::now()->$unit); // int(57)
// If you have plural unit name, use singularUnit()
$unit = Carbon::singularUnit('seconds');
-var_dump(Carbon::now()->get($unit)); // int(24)
+var_dump(Carbon::now()->get($unit)); // int(57)
// Prefer using singularUnit() because some plurals are not the word with S:
var_dump(Carbon::pluralUnit('century')); // string(9) "centuries"
var_dump(Carbon::pluralUnit('millennium')); // string(9) "millennia"
@@ -6006,8 +6006,8 @@ Weeks
var_dump($ar->firstWeekDay); // int(6)
var_dump($ar->lastWeekDay); // int(5)
-var_dump($ar->startOfWeek()->format('Y-m-d H:i')); // string(16) "2023-11-18 00:00"
-var_dump($ar->endOfWeek()->format('Y-m-d H:i')); // string(16) "2023-11-24 23:59"
+var_dump($ar->startOfWeek()->format('Y-m-d H:i')); // string(16) "2023-11-25 00:00"
+var_dump($ar->endOfWeek()->format('Y-m-d H:i')); // string(16) "2023-12-01 23:59"
$en = CarbonImmutable::parse('2015-02-05'); // use en_US as default locale
@@ -6273,7 +6273,7 @@ Conversion
["formatted"]=>
string(19) "2019-02-01 03:45:27"
["timezone"]=>
- object(Carbon\CarbonTimeZone)#1479 (2) {
+ object(Carbon\CarbonTimeZone)#4438 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
@@ -6284,7 +6284,7 @@ Conversion
var_dump($dt->toObject());
/*
-object(stdClass)#1479 (12) {
+object(stdClass)#4438 (12) {
["year"]=>
int(2019)
["month"]=>
@@ -6308,7 +6308,7 @@ Conversion
["formatted"]=>
string(19) "2019-02-01 03:45:27"
["timezone"]=>
- object(Carbon\CarbonTimeZone)#1474 (2) {
+ object(Carbon\CarbonTimeZone)#9955 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
@@ -6319,7 +6319,7 @@ Conversion
var_dump($dt->toDate()); // Same as $dt->toDateTime()
/*
-object(DateTime)#1479 (3) {
+object(DateTime)#4438 (3) {
["date"]=>
string(26) "2019-02-01 03:45:27.612584"
["timezone_type"]=>
@@ -6333,7 +6333,7 @@ Conversion
// to both DateTime and DateTimeImmutable
var_dump($dt->toDateTimeImmutable());
/*
-object(DateTimeImmutable)#1479 (3) {
+object(DateTimeImmutable)#4438 (3) {
["date"]=>
string(26) "2019-02-01 03:45:27.612584"
["timezone_type"]=>
@@ -6506,8 +6506,8 @@ Comparison
// now is the default param
$dt1 = Carbon::createMidnightDate(2000, 1, 1);
-echo $dt1->max(); // 2023-11-22 14:37:24
-echo $dt1->maximum(); // 2023-11-22 14:37:24
+echo $dt1->max(); // 2023-11-25 13:42:57
+echo $dt1->maximum(); // 2023-11-25 13:42:57
// Remember min and max PHP native function work fine with dates too:
echo max(Carbon::create('2002-03-15'), Carbon::create('2003-01-07'), Carbon::create('2002-08-25')); // 2003-01-07 00:00:00
@@ -7774,7 +7774,7 @@ Macro
echo "\n";
echo Carbon::tomorrow()->formatForUser(); // Demain à 01:00
echo "\n";
-echo Carbon::now()->subDays(3)->formatForUser(); // dimanche dernier à 15:37
+echo Carbon::now()->subDays(3)->formatForUser(); // mercredi dernier à 14:42
@@ -8039,7 +8039,7 @@ Macro
dumpDateList(Carbon::getCurrentWeekDays()); // 2023-11-20 00:00:00, 2023-11-21 00:00:00, 2023-11-22 00:00:00, 2023-11-23 00:00:00, 2023-11-24 00:00...
dumpDateList(Carbon::getCurrentMonthDays()); // 2023-11-01 00:00:00, 2023-11-02 00:00:00, 2023-11-03 00:00:00, 2023-11-04 00:00:00, 2023-11-05 00:00...
-dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2023-10-16 00:00:00, 2023-10-17 00:00:00, 2023-10-18 00:00:00, 2023-10-19 00:00:00, 2023-10-20 00:00...
+dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2023-10-23 00:00:00, 2023-10-24 00:00:00, 2023-10-25 00:00:00, 2023-10-26 00:00:00, 2023-10-27 00:00...
dumpDateList(Carbon::now()->subMonth()->getCurrentMonthDays()); // 2023-10-01 00:00:00, 2023-10-02 00:00:00, 2023-10-03 00:00:00, 2023-10-04 00:00:00, 2023-10-05 00:00...
@@ -9007,7 +9007,7 @@ CarbonPeriod
$days[] = $date->format('Y-m-d');
}
-echo implode(', ', $days); // 2023-11-22, 2023-11-23, 2023-11-24
+echo implode(', ', $days); // 2023-11-25, 2023-11-26, 2023-11-27
diff --git a/index.html b/index.html
index 0447daa391..7e745979ff 100644
--- a/index.html
+++ b/index.html
@@ -264,6 +264,9 @@ Backers
+
+
+
diff --git a/reference/index.html b/reference/index.html
index 03da3d628c..c42ae03a67 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -19,14 +19,14 @@ Carbon::__serialize
no arguments
returns array
Returns the values to dump on serialize() called on.
Only used by PHP >= 7.4.
- Method added | 2.58.0 | no arguments |
+ Method added | 2.40.0 | no arguments |
Carbon::__unserialize
array $data
Set locale if specified on unserialize() called.
Only used by PHP >= 7.4.
-
Method added | 2.58.0 | array $data |
+
Method added | 2.40.0 | array $data |
@@ -156,7 +156,7 @@
Carbon::setTimestamp
$unixTimestamp
returns Carbon
Set the instance's timestamp.
Timestamp input can be given as int, float or a string containing one or more numbers.
-
Prototype changed | 2.41.0 | $unixTimestamp |
Method added | 1.0.0 | $unixtimestamp |
+
Prototype changed | 2.40.0 | $unixTimestamp |
Method added | 1.0.0 | $unixtimestamp |
@@ -197,7 +197,7 @@
Carbon::avoidMutation
returns Carbon
Clone the current instance if it's mutable.
This method is convenient to ensure you don't mutate the initial object
but avoid to make a useless copy of it if it's already immutable.
-
Method added | 2.50.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -326,7 +326,7 @@
Carbon::getDaysFromStartOfWeek
returns int
Return the number of days since the start of the week (using the current locale or the first parameter
if explicitly given).
-
Method added | 2.63.0 | ?int $weekStartsAt = null |
+
Method added | 2.40.0 | ?int $weekStartsAt = null |
@@ -335,7 +335,7 @@
Carbon::setDaysFromStartOfWeek
returns Carbon
Set the day (keeping the current time) to the start of the week + the number of days passed as the first
parameter. First day of week is driven by the locale unless explicitly set with the second parameter.
-
Method added | 2.63.0 | int $numberOfDays, ?int $weekStartsAt = null |
+
Method added | 2.40.0 | int $numberOfDays, ?int $weekStartsAt = null |
@@ -367,7 +367,7 @@
Carbon::utcOffset
?int $minuteOffset = null
returns int|Carbon
Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed.
-
Prototype changed | 2.54.0 | ?int $minuteOffset = null |
Prototype changed | 2.44.0 | int $minuteOffset = null |
Method added | 2.0.0 | int $offset = null |
+
Prototype changed | 2.40.0 | ?int $minuteOffset = null |
Method added | 2.0.0 | int $offset = null |
@@ -574,7 +574,7 @@
Carbon::ordinal
string $key, ?string $period = null
returns string
Return a property with its ordinal.
-
Prototype changed | 2.54.0 | string $key, ?string $period = null |
Method added | 2.0.0 | string $key, string $period = null |
+
Prototype changed | 2.40.0 | string $key, ?string $period = null |
Method added | 2.0.0 | string $key, string $period = null |
@@ -598,7 +598,7 @@
Carbon::isoFormat
string $format, ?string $originalFormat = null
returns string
Format in the current language using ISO replacement patterns.
-
Prototype changed | 2.54.0 | string $format, ?string $originalFormat = null |
Prototype changed | 2.16.0 | string $format, string $originalFormat = null |
Method added | 2.0.0 | string $format |
+
Prototype changed | 2.40.0 | string $format, ?string $originalFormat = null |
Prototype changed | 2.16.0 | string $format, string $originalFormat = null |
Method added | 2.0.0 | string $format |
@@ -1282,7 +1282,7 @@
Carbon::hasFormatWithModifiers
returns bool
Checks if the (date)time string is in a given format.
Examples:
Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true
Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false
-
Prototype changed | 2.41.2 | $date, $format |
Method added | 2.41.0 | string $date, string $format |
+
Method added | 2.40.0 | $date, $format |
@@ -1328,7 +1328,7 @@
Carbon::isEndOfTime
no arguments
returns bool
Returns true if the date was created using CarbonImmutable::endOfTime()
-
Method added | 2.48.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -1735,7 +1735,7 @@
Carbon::createStrict
?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null
returns Carbon
Create a new Carbon instance from a specific date and time using strict validation.
-
Prototype changed | 2.54.0 | ?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null |
Method added | 2.49.0 | int $year = 0, int $month = 1, int $day = 1, int $hour = 0, int $minute = 0, int $second = 0, $tz = null |
+
Method added | 2.40.0 | ?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null |
@@ -1818,7 +1818,7 @@
Carbon::diffAsCarbonInterval
Get the difference as a CarbonInterval instance.
Return relative interval (negative if $absolute flag is not set to true and the given date is before
current one).
-
Prototype changed | 2.63.0 | $date = null, $absolute = true, array $skip = [] |
Prototype changed | 2.0.0 | $date = null, $absolute = true |
Prototype changed | 1.35.0 | $date = null, $absolute = true, $trimMicroseconds = true |
Method added | 1.26.0 | $date = null, $absolute = true |
+
Prototype changed | 2.40.0 | $date = null, $absolute = true, array $skip = [] |
Prototype changed | 2.0.0 | $date = null, $absolute = true |
Prototype changed | 1.35.0 | $date = null, $absolute = true, $trimMicroseconds = true |
Method added | 1.26.0 | $date = null, $absolute = true |
@@ -2746,7 +2746,7 @@
Carbon::getTranslationMessageWith
$translator, string $key, ?string $locale = null, ?string $default = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
+
Prototype changed | 2.40.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
@@ -2754,7 +2754,7 @@
Carbon::getTranslationMessage
string $key, ?string $locale = null, ?string $default = null, $translator = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Prototype changed | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
Method added | 2.0.0 | string $key, string $locale = null, string $default = null |
+
Prototype changed | 2.40.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Prototype changed | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
Method added | 2.0.0 | string $key, string $locale = null, string $default = null |
@@ -2770,7 +2770,7 @@
Carbon::translate
string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
returns string
Translate using translation string or callback available.
-
Prototype changed | 2.54.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
Method added | 2.0.0 | string $key, array $parameters = [], $number = null |
+
Prototype changed | 2.40.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
Method added | 2.0.0 | string $key, array $parameters = [], $number = null |
@@ -2802,7 +2802,7 @@
Carbon::locale
?string $locale = null, $fallbackLocales
returns $this|string
Get/set the locale for the current instance.
-
Prototype changed | 2.54.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
+
Prototype changed | 2.40.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
@@ -3059,17 +3059,17 @@
Carbon::setTestNowAndTimezone
- When a string containing the desired time is passed to Carbon::parse().
It will also align default timezone (e.g. call date_default_timezone_set()) with
the second argument or if null, with the timezone of the given date object.
To clear the test instance call this method using the default
parameter of null.
/!\ Use this method for unit tests only.
-
Method added | 2.54.0 | $testNow = null, $tz = null |
+
Method added | 2.40.0 | $testNow = null, $tz = null |
Carbon::withTestNow
$testNow, $callback
-
returns mixed
+
returns T
Temporarily sets a static date to be used within the callback.
Using setTestNow to set the date, executing the callback, then
clearing the test instance.
/!\ Use this method for unit tests only.
-
Prototype changed | 2.63.0 | $testNow, $callback |
Method added | 2.41.0 | $testNow = null, $callback = null |
+
Method added | 2.40.0 | $testNow, $callback |
@@ -3111,7 +3111,7 @@
Carbon::createFromTimestampMsUTC
$timestamp
returns Carbon
Create a Carbon instance from a timestamp in milliseconds.
Timestamp input can be given as int, float or a string containing one or more numbers.
-
Method added | 2.41.0 | $timestamp |
+
Method added | 2.40.0 | $timestamp |
@@ -3127,7 +3127,7 @@
Carbon::timestamp
$unixTimestamp
returns Carbon
Set the instance's timestamp.
Timestamp input can be given as int, float or a string containing one or more numbers.
-
Prototype changed | 2.41.0 | $unixTimestamp |
Method added | 1.0.0 | $value |
+
Prototype changed | 2.40.0 | $unixTimestamp |
Method added | 1.0.0 | $value |
@@ -3151,7 +3151,7 @@
Carbon::getTimestampMs
no arguments
returns int
Returns the timestamp with millisecond precision.
-
Method added | 2.51.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -4600,7 +4600,7 @@
CarbonInterval::setTimezone
$tzName
returns CarbonInterval
Set the instance's timezone from a string or object.
-
Method added | 2.52.0 | $tzName |
+
Method added | 2.40.0 | $tzName |
@@ -4633,7 +4633,7 @@
CarbonInterval::enableFloatSetters
values will no longer be cast to integer (so truncated).
⚠️ This settings will be applied globally, which mean your whole application
code including the third-party dependencies that also may use Carbon will
adopt the new behavior.
-
Method added | 2.69.0 | bool $floatSettersEnabled = true |
+
Method added | 2.40.0 | bool $floatSettersEnabled = true |
@@ -4657,7 +4657,7 @@
CarbonInterval::getFactorWithDefault
returns int|float|null
Returns the factor for a given source-to-target couple if set,
else try to find the appropriate constant as the factor, such as Carbon::DAYS_PER_WEEK.
-
Method added | 2.55.0 | $source, $target |
+
Method added | 2.40.0 | $source, $target |
@@ -4724,7 +4724,7 @@
CarbonInterval::createFromFormat
string $format, ?string $interval
returns CarbonInterval
Parse a string into a new CarbonInterval object according to the specified format.
Examples:
echo Carboninterval::createFromFormat('H:i', '1:30');
-
Prototype changed | 2.54.0 | string $format, ?string $interval |
Method added | 2.27.0 | string $format, string $interval |
+
Prototype changed | 2.40.0 | string $format, ?string $interval |
Method added | 2.27.0 | string $format, string $interval |
@@ -4748,7 +4748,7 @@
CarbonInterval::__set_state
$dump
returns CarbonInterval
Evaluate the PHP generated by var_export() and recreate the exported CarbonInterval instance.
-
Prototype changed | 2.71.0 | $dump |
Method added | 1.18.0 | array $array |
+
Prototype changed | 2.40.0 | $dump |
Method added | 1.18.0 | array $array |
@@ -4793,7 +4793,7 @@
CarbonInterval::instance
Create a CarbonInterval instance from a DateInterval one. Can not instance
DateInterval objects created from DateTime::diff() as you can't externally
set the $days field.
-
Prototype changed | 2.69.0 | DateInterval $interval, array $skip = [], bool $skipCopy = false |
Prototype changed | 2.63.0 | DateInterval $interval, array $skip = [] |
Prototype changed | 2.21.0 | DateInterval $interval |
Prototype changed | 2.0.0 | DateInterval $di |
Prototype changed | 1.35.0 | DateInterval $di, $trimMicroseconds = true |
Method added | 1.18.0 | DateInterval $di |
+
Prototype changed | 2.40.0 | DateInterval $interval, array $skip = [], bool $skipCopy = false |
Prototype changed | 2.21.0 | DateInterval $interval |
Prototype changed | 2.0.0 | DateInterval $di |
Prototype changed | 1.35.0 | DateInterval $di, $trimMicroseconds = true |
Method added | 1.18.0 | DateInterval $di |
@@ -4802,7 +4802,7 @@
CarbonInterval::make
returns CarbonInterval|null
Make a CarbonInterval instance from given variable if possible.
Always return a new instance. Parse only strings and only these likely to be intervals (skip dates
and recurrences). Throw an exception for invalid format, but otherwise return null.
-
Prototype changed | 2.69.0 | $interval, $unit = null, bool $skipCopy = false |
Prototype changed | 2.34.0 | $interval, $unit = null |
Method added | 1.28.0 | $var |
+
Prototype changed | 2.40.0 | $interval, $unit = null, bool $skipCopy = false |
Prototype changed | 2.34.0 | $interval, $unit = null |
Method added | 1.28.0 | $var |
@@ -4999,7 +4999,7 @@
CarbonInterval::plus
$years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0
returns CarbonInterval
Add given parameters to the current interval.
-
Method added | 2.45.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
+
Method added | 2.40.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
@@ -5007,7 +5007,7 @@
CarbonInterval::minus
$years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0
returns CarbonInterval
Add given parameters to the current interval.
-
Method added | 2.45.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
+
Method added | 2.40.0 | $years = 0, $months = 0, $weeks = 0, $days = 0, $hours = 0, $minutes = 0, $seconds = 0, $microseconds = 0 |
@@ -5051,7 +5051,7 @@
CarbonInterval::getDateIntervalSpec
DateInterval $interval, bool $microseconds = false, array $skip = []
returns string
Get the interval_spec string of a date interval.
-
Prototype changed | 2.63.0 | DateInterval $interval, bool $microseconds = false, array $skip = [] |
Prototype changed | 2.58.0 | DateInterval $interval, bool $microseconds = false |
Method added | 1.26.0 | DateInterval $interval |
+
Prototype changed | 2.40.0 | DateInterval $interval, bool $microseconds = false, array $skip = [] |
Method added | 1.26.0 | DateInterval $interval |
@@ -5059,7 +5059,7 @@
CarbonInterval::spec
bool $microseconds = false
returns string
Get the interval_spec string.
-
Prototype changed | 2.58.0 | bool $microseconds = false |
Method added | 1.22.0 | no arguments |
+
Prototype changed | 2.40.0 | bool $microseconds = false |
Method added | 1.22.0 | no arguments |
@@ -5336,7 +5336,7 @@
CarbonInterval::getStep
CarbonInterval::setStep
?Closure $step
Set a step to apply instead of a fixed interval to get the new date.
Or pass null to switch to fixed interval.
-
Prototype changed | 2.54.0 | ?Closure $step |
Method added | 2.36.0 | Closure $step |
+
Prototype changed | 2.40.0 | ?Closure $step |
Method added | 2.36.0 | Closure $step |
@@ -5546,7 +5546,7 @@
CarbonInterval::getTranslationMessageWith$translator, string $key, ?string $locale = null, ?string $default = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
+
Prototype changed | 2.40.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
@@ -5554,7 +5554,7 @@
CarbonInterval::getTranslationMessage
string $key, ?string $locale = null, ?string $default = null, $translator = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Method added | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
+
Prototype changed | 2.40.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Method added | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
@@ -5570,7 +5570,7 @@
CarbonInterval::translate
string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
returns string
Translate using translation string or callback available.
-
Prototype changed | 2.54.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
+
Prototype changed | 2.40.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
@@ -5602,7 +5602,7 @@
CarbonInterval::locale
?string $locale = null, $fallbackLocales
returns $this|string
Get/set the locale for the current instance.
-
Prototype changed | 2.54.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
+
Prototype changed | 2.40.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
@@ -5713,7 +5713,7 @@
CarbonInterval::getAvailableLocalesInfo
CarbonInterval::resetToStringFormat
no arguments
Reset the format used to the default when type juggling a Carbon instance to a string
-
Method added | 2.63.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -5830,7 +5830,7 @@
CarbonPeriod::get
string $name
returns bool|CarbonInterface|CarbonInterval|int|null
Get a property allowing both `DatePeriod` snakeCase and camelCase names.
-
Method added | 2.45.0 | string $name |
+
Method added | 2.40.0 | string $name |
@@ -5838,7 +5838,7 @@
CarbonPeriod::__get
string $name
returns bool|CarbonInterface|CarbonInterval|int|null
Get a property allowing both `DatePeriod` snakeCase and camelCase names.
-
Method added | 2.41.0 | string $name |
+
Method added | 2.40.0 | string $name |
@@ -5846,7 +5846,7 @@
CarbonPeriod::__isset
string $name
returns bool
Check if an attribute exists on the object
-
Method added | 2.41.0 | string $name |
+
Method added | 2.40.0 | string $name |
@@ -5950,7 +5950,7 @@
CarbonPeriod::getStartDate
?string $rounding = null
returns CarbonInterface
Get start date of the period.
-
Prototype changed | 2.54.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 1.29.0 | no arguments |
+
Prototype changed | 2.40.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 1.29.0 | no arguments |
@@ -5958,7 +5958,7 @@
CarbonPeriod::getEndDate
?string $rounding = null
returns CarbonInterface|null
Get end date of the period.
-
Prototype changed | 2.54.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 1.29.0 | no arguments |
+
Prototype changed | 2.40.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 1.29.0 | no arguments |
@@ -6191,7 +6191,7 @@
CarbonPeriod::isUnfilteredAndEndLess
Return `true` if the period has no custom filter and is guaranteed to be endless.
Note that we can't check if a period is endless as soon as it has custom filters
because filters can emit `CarbonPeriod::END_ITERATION` to stop the iteration in
a way we can't predict without actually iterating the period.
-
Method added | 2.58.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -6239,7 +6239,7 @@
CarbonPeriod::setTimezone
$timezone
returns CarbonPeriod
Set the instance's timezone from a string or object and apply it to start/end.
-
Method added | 2.52.0 | $timezone |
+
Method added | 2.40.0 | $timezone |
@@ -6255,7 +6255,7 @@
CarbonPeriod::calculateEnd
?string $rounding = null
returns CarbonInterface
Returns the end is set, else calculated from start an recurrences.
-
Prototype changed | 2.54.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 2.20.0 | no arguments |
+
Prototype changed | 2.40.0 | ?string $rounding = null |
Prototype changed | 2.23.0 | string $rounding = null |
Method added | 2.20.0 | no arguments |
@@ -6731,7 +6731,7 @@
CarbonPeriod::getTranslationMessageWith
$translator, string $key, ?string $locale = null, ?string $default = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
+
Prototype changed | 2.40.0 | $translator, string $key, ?string $locale = null, ?string $default = null |
Method added | 2.8.0 | $translator, string $key, string $locale = null, string $default = null |
@@ -6739,7 +6739,7 @@
CarbonPeriod::getTranslationMessage
string $key, ?string $locale = null, ?string $default = null, $translator = null
returns string
Returns raw translation message for a given key.
-
Prototype changed | 2.54.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Method added | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
+
Prototype changed | 2.40.0 | string $key, ?string $locale = null, ?string $default = null, $translator = null |
Method added | 2.8.0 | string $key, string $locale = null, string $default = null, $translator = null |
@@ -6755,7 +6755,7 @@
CarbonPeriod::translate
string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false
returns string
Translate using translation string or callback available.
-
Prototype changed | 2.54.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
+
Prototype changed | 2.40.0 | string $key, array $parameters = [], $number = null, ?Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Prototype changed | 2.23.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null, bool $altNumbers = false |
Method added | 2.8.0 | string $key, array $parameters = [], $number = null, Symfony\Component\Translation\TranslatorInterface $translator = null |
@@ -6787,7 +6787,7 @@
CarbonPeriod::locale
?string $locale = null, $fallbackLocales
returns $this|string
Get/set the locale for the current instance.
-
Prototype changed | 2.54.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
+
Prototype changed | 2.40.0 | ?string $locale = null, $fallbackLocales |
Prototype changed | 2.16.0 | string $locale = null, $fallbackLocales |
Method added | 2.0.0 | string $locale = null |
@@ -6898,7 +6898,7 @@
CarbonPeriod::getAvailableLocalesInfo
CarbonPeriod::resetToStringFormat
no arguments
Reset the format used to the default when type juggling a Carbon instance to a string
-
Method added | 2.63.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -6955,7 +6955,7 @@
CarbonTimeZone::toOffsetName
?DateTimeInterface $date = null
returns string
Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30").
-
Prototype changed | 2.54.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
+
Prototype changed | 2.40.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
@@ -6963,7 +6963,7 @@
CarbonTimeZone::toOffsetTimeZone
?DateTimeInterface $date = null
returns CarbonTimeZone
Returns a new CarbonTimeZone object using the offset string instead of region string.
-
Prototype changed | 2.54.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
+
Prototype changed | 2.40.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
@@ -6972,7 +6972,7 @@
CarbonTimeZone::toRegionName
returns string|false
Returns the first region string (such as "America/Toronto") that matches the current timezone or
false if no match is found.
-
Prototype changed | 2.54.0 | ?DateTimeInterface $date = null, $isDst = 1 |
Method added | 2.10.0 | DateTimeInterface $date = null, $isDst = 1 |
+
Prototype changed | 2.40.0 | ?DateTimeInterface $date = null, $isDst = 1 |
Method added | 2.10.0 | DateTimeInterface $date = null, $isDst = 1 |
@@ -6980,7 +6980,7 @@
CarbonTimeZone::toRegionTimeZone
?DateTimeInterface $date = null
returns CarbonTimeZone|false
Returns a new CarbonTimeZone object using the region string instead of offset string.
-
Prototype changed | 2.54.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
+
Prototype changed | 2.40.0 | ?DateTimeInterface $date = null |
Method added | 2.10.0 | DateTimeInterface $date = null |
@@ -6998,7 +6998,7 @@
CarbonTimeZone::getType
Return the type number:
Type 1; A UTC offset, such as -0300
Type 2; A timezone abbreviation, such as GMT
Type 3: A timezone identifier, such as Europe/London
-
Method added | 2.58.0 | no arguments |
+
Method added | 2.40.0 | no arguments |
@@ -7100,7 +7100,7 @@
Translator::trans
?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null
returns string
-
Prototype changed | 2.55.0 | ?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null |
Method added | 1.25.0 | $id, array $parameters = [], $domain = null, $locale = null |
+
Prototype changed | 2.40.0 | ?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null |
Method added | 1.25.0 | $id, array $parameters = [], $domain = null, $locale = null |
@@ -7108,7 +7108,7 @@
Translator::getFromCatalogue
Symfony\Component\Translation\MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages'
returns mixed
@param mixed $translator
-
Method added | 2.55.0 | Symfony\Component\Translation\MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages' |
+
Method added | 2.40.0 | Symfony\Component\Translation\MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages' |
@@ -7124,7 +7124,7 @@
Translator::__construct
$locale, ?Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false
Create a new Carbon instance.
Please see the testing aids section (specifically static::setTestNow())
for more on the possibility of this constructor returning a test instance.
-
Prototype changed | 2.54.0 | $locale, ?Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false |
Method added | 1.25.0 | $locale, Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false |
+
Prototype changed | 2.40.0 | $locale, ?Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false |
Method added | 1.25.0 | $locale, Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false |
diff --git a/tools/api-history.php b/tools/api-history.php
index 695734ee73..069134b1e2 100644
--- a/tools/api-history.php
+++ b/tools/api-history.php
@@ -3,6 +3,7 @@
namespace ApiHistory;
include_once __DIR__.'/config.php';
+require_once __DIR__.'/functions.php';
set_time_limit(0);
chdir(__DIR__.'/..');
@@ -172,7 +173,7 @@ function getMethodsOfVersion($version)
chdir('..');
if (strpos($output, 'Installation failed') !== false) {
- file_put_contents(__DIR__.'/../temp.txt', $output);
+ writeFile('temp.txt', $output);
echo "\nError on $version:\n$output\n";
exit(1);
}
@@ -180,7 +181,7 @@ function getMethodsOfVersion($version)
$output = shell_exec('php '.__FILE__.' current '.escapeshellarg('sandbox'));
if (!empty($output)) {
- file_put_contents(__DIR__.'/cache/methods_of_version_'.$version.'.json', $output);
+ writeFile('tools/cache/methods_of_version_'.$version.'.json', $output);
}
return $output;
@@ -192,7 +193,7 @@ function getMethodsOfVersion($version)
$data = json_decode($output);
if (!is_array($data) && !is_object($data)) {
- file_put_contents(__DIR__.'/../temp2.txt', $output);
+ writeFile('temp2.txt', $output);
echo "\nError on $version:\n$output\n";
exit(1);
}
@@ -200,7 +201,7 @@ function getMethodsOfVersion($version)
$data = (array) $data;
if (isset($data['error'])) {
- file_put_contents(__DIR__.'/../temp3.txt', var_export($data, true));
+ writeFile('temp3.txt', var_export($data, true));
echo "\nError on $version:\n";
print_r($data);
exit(1);
@@ -213,7 +214,7 @@ function getMethodsOfVersion($version)
echo "100%\nDumping results.\n";
-file_put_contents('history.json', json_encode($methods, JSON_PRETTY_PRINT));
+writeJson('history.json', $methods);
echo "Done\n";
diff --git a/tools/cache-releases.php b/tools/cache-releases.php
index 58bca5cd3a..9383b75b74 100644
--- a/tools/cache-releases.php
+++ b/tools/cache-releases.php
@@ -41,4 +41,6 @@
}
} while (count($data));
-file_put_contents(__DIR__.'/../releases.json', json_encode($releases, JSON_PRETTY_PRINT));
+require_once __DIR__.'/functions.php';
+
+writeJson('releases.json', $releases);
diff --git a/tools/functions.php b/tools/functions.php
new file mode 100644
index 0000000000..d2e6f8faac
--- /dev/null
+++ b/tools/functions.php
@@ -0,0 +1,16 @@
+ 0;
+}
+
+function writeFile(string $path, string $content): bool
+{
+ return writeFileAtPath(__DIR__ . '/../' . $path, $content);
+}
+
+function writeJson(string $path, mixed $data): bool
+{
+ return writeFile($path, json_encode($data, JSON_PRETTY_PRINT));
+}
diff --git a/tools/generate.php b/tools/generate.php
index 9d1a57a5db..3a005e84c2 100644
--- a/tools/generate.php
+++ b/tools/generate.php
@@ -1,6 +1,7 @@
'var_dump',
]));
- return $dest ? file_put_contents($dest, $code) : $code;
+ return $dest ? writeFileAtPath($dest, $code) : $code;
}
-file_put_contents('languages.json', json_encode(Language::all(), JSON_PRETTY_PRINT));
+writeJson('languages.json', Language::all());
$languages = array_map(function ($code) {
$lang = new Language($code);
@@ -556,7 +557,7 @@ function compile($src, $dest = null)
]);
}, Carbon::getAvailableLocales());
-file_put_contents('contribute/translate/assets/languages.json', json_encode($languages, JSON_PRETTY_PRINT));
+writeJson('contribute/translate/assets/languages.json', $languages);
$translations = [
['CarbonInterval::years(2)', '->forHumans()'],
@@ -646,9 +647,9 @@ function compile($src, $dest = null)
$output[$start.$end] = eval("use Carbon\Carbon; use Carbon\CarbonInterval; return {$start}->locale('{$locale}'){$end};");
}
- file_put_contents(
+ writeJson(
'contribute/translate/assets/translations/'.$locale.'.json',
- str_replace("\r", '', json_encode($output, JSON_PRETTY_PRINT))
+ $output
);
}
diff --git a/tools/release.php b/tools/release.php
index cb8eee5c24..8512c6ad3e 100644
--- a/tools/release.php
+++ b/tools/release.php
@@ -17,9 +17,11 @@
$composer
);
+require_once __DIR__.'/functions.php';
+
echo $newComposer === $composer
? 'nesbot/carbon is already on '
- : (file_put_contents(__DIR__ . '/../composer.json', $newComposer)
+ : (writeJson('composer.json', $newComposer)
? 'Upgraded nesbot/carbon to '
: 'Unable to upgrade nesbot/carbon to '
);