mirror of
https://github.com/itflow-org/itflow
synced 2026-08-19 14:05:12 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
@@ -202,9 +202,7 @@ abstract class AbstractTranslator extends SymfonyTranslator
|
||||
$files = [];
|
||||
|
||||
foreach ($this->getDirectories() as $directory) {
|
||||
$directory = rtrim($directory, '\\/');
|
||||
|
||||
foreach (glob("$directory/$prefix*.php") as $file) {
|
||||
foreach (self::getPhpFilesInDirectory(rtrim($directory, '\\/'), $prefix) as $file) {
|
||||
$files[] = $file;
|
||||
}
|
||||
}
|
||||
@@ -222,20 +220,18 @@ abstract class AbstractTranslator extends SymfonyTranslator
|
||||
*/
|
||||
public function getAvailableLocales(string $prefix = ''): array
|
||||
{
|
||||
$locales = [];
|
||||
foreach ($this->getLocalesFiles($prefix) as $file) {
|
||||
$locales[] = substr($file, strrpos($file, '/') + 1, -4);
|
||||
}
|
||||
|
||||
return array_unique(array_merge($locales, array_keys($this->messages)));
|
||||
return array_unique(array_merge(
|
||||
array_map(
|
||||
static fn (string $file) => substr($file, strrpos($file, '/') + 1, -4),
|
||||
$this->getLocalesFiles($prefix),
|
||||
),
|
||||
array_keys($this->messages),
|
||||
));
|
||||
}
|
||||
|
||||
protected function translate(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
|
||||
{
|
||||
if ($domain === null) {
|
||||
$domain = 'messages';
|
||||
}
|
||||
|
||||
$domain ??= 'messages';
|
||||
$catalogue = $this->getCatalogue($locale);
|
||||
$format = $this instanceof TranslatorStrongTypeInterface
|
||||
? $this->getFromCatalogue($catalogue, (string) $id, $domain)
|
||||
@@ -352,16 +348,20 @@ abstract class AbstractTranslator extends SymfonyTranslator
|
||||
|
||||
usort($locales, static fn ($first, $second) => $getScore($second) <=> $getScore($first));
|
||||
|
||||
$locale = $locales[0];
|
||||
$locale = $locales[0] ?? 'en';
|
||||
}
|
||||
|
||||
if (isset($this->aliases[$locale])) {
|
||||
$locale = $this->aliases[$locale];
|
||||
}
|
||||
|
||||
// If subtag (ex: en_CA) first load the macro (ex: en) to have a fallback
|
||||
if (str_contains($locale, '_') &&
|
||||
$this->loadMessagesFromFile($macroLocale = preg_replace('/^([^_]+).*$/', '$1', $locale))
|
||||
// If the language is not provided by a Carbon file
|
||||
// and the tag contains a region (ex: en_CA), then
|
||||
// first load the macro (ex: en) to have a fallback
|
||||
if (
|
||||
str_contains($locale, '_')
|
||||
&& !\in_array($locale, self::getInternallySupportedLocales(), true)
|
||||
&& $this->loadMessagesFromFile($macroLocale = preg_replace('/^([^_]+).*$/', '$1', $locale))
|
||||
) {
|
||||
parent::setLocale($macroLocale);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ abstract class AbstractTranslator extends SymfonyTranslator
|
||||
{
|
||||
parent::setLocale($locale);
|
||||
$this->initializing = true;
|
||||
$this->directories = [__DIR__.'/Lang'];
|
||||
$this->directories = [self::getDefaultLangDirectory()];
|
||||
$this->addLoader('array', new ArrayLoader());
|
||||
parent::__construct($locale, new MessageFormatterMapper($formatter), $cacheDir, $debug);
|
||||
$this->initializing = false;
|
||||
@@ -437,4 +437,863 @@ abstract class AbstractTranslator extends SymfonyTranslator
|
||||
// Clear resources if available, if not, then nothing to clean
|
||||
}
|
||||
}
|
||||
|
||||
private static function getPhpFilesInDirectory(string $directory, string $prefix): array
|
||||
{
|
||||
if ($directory !== self::getDefaultLangDirectory()) {
|
||||
return glob("$directory/$prefix*.php") ?: [];
|
||||
}
|
||||
|
||||
// If it's the internal Carbon directory we use a static list
|
||||
// which is faster than scanning the folder with glob()
|
||||
$locales = self::getInternallySupportedLocales();
|
||||
|
||||
if ($prefix !== '') {
|
||||
$locales = array_values(array_filter(
|
||||
self::getInternallySupportedLocales(),
|
||||
static fn (string $locale) => str_starts_with($locale, $prefix),
|
||||
));
|
||||
}
|
||||
|
||||
return array_map(
|
||||
static fn (string $locale) => "$directory/$locale.php",
|
||||
$locales,
|
||||
);
|
||||
}
|
||||
|
||||
private static function getDefaultLangDirectory(): string
|
||||
{
|
||||
return __DIR__.'/Lang';
|
||||
}
|
||||
|
||||
/** @return list<string> */
|
||||
private static function getInternallySupportedLocales(): array
|
||||
{
|
||||
return [
|
||||
'aa',
|
||||
'aa_DJ',
|
||||
'aa_ER',
|
||||
'aa_ER@saaho',
|
||||
'aa_ET',
|
||||
'af',
|
||||
'af_NA',
|
||||
'af_ZA',
|
||||
'agq',
|
||||
'agr',
|
||||
'agr_PE',
|
||||
'ak',
|
||||
'ak_GH',
|
||||
'am',
|
||||
'am_ET',
|
||||
'an',
|
||||
'an_ES',
|
||||
'anp',
|
||||
'anp_IN',
|
||||
'ar',
|
||||
'ar_AE',
|
||||
'ar_BH',
|
||||
'ar_DJ',
|
||||
'ar_DZ',
|
||||
'ar_EG',
|
||||
'ar_EH',
|
||||
'ar_ER',
|
||||
'ar_IL',
|
||||
'ar_IN',
|
||||
'ar_IQ',
|
||||
'ar_JO',
|
||||
'ar_KM',
|
||||
'ar_KW',
|
||||
'ar_LB',
|
||||
'ar_LY',
|
||||
'ar_MA',
|
||||
'ar_MR',
|
||||
'ar_OM',
|
||||
'ar_PS',
|
||||
'ar_QA',
|
||||
'ar_SA',
|
||||
'ar_SD',
|
||||
'ar_SO',
|
||||
'ar_SS',
|
||||
'ar_SY',
|
||||
'ar_Shakl',
|
||||
'ar_TD',
|
||||
'ar_TN',
|
||||
'ar_YE',
|
||||
'as',
|
||||
'as_IN',
|
||||
'asa',
|
||||
'ast',
|
||||
'ast_ES',
|
||||
'ayc',
|
||||
'ayc_PE',
|
||||
'az',
|
||||
'az_AZ',
|
||||
'az_Arab',
|
||||
'az_Cyrl',
|
||||
'az_IR',
|
||||
'az_Latn',
|
||||
'bas',
|
||||
'be',
|
||||
'be_BY',
|
||||
'be_BY@latin',
|
||||
'bem',
|
||||
'bem_ZM',
|
||||
'ber',
|
||||
'ber_DZ',
|
||||
'ber_MA',
|
||||
'bez',
|
||||
'bg',
|
||||
'bg_BG',
|
||||
'bhb',
|
||||
'bhb_IN',
|
||||
'bho',
|
||||
'bho_IN',
|
||||
'bi',
|
||||
'bi_VU',
|
||||
'bm',
|
||||
'bn',
|
||||
'bn_BD',
|
||||
'bn_IN',
|
||||
'bo',
|
||||
'bo_CN',
|
||||
'bo_IN',
|
||||
'br',
|
||||
'br_FR',
|
||||
'brx',
|
||||
'brx_IN',
|
||||
'bs',
|
||||
'bs_BA',
|
||||
'bs_Cyrl',
|
||||
'bs_Latn',
|
||||
'byn',
|
||||
'byn_ER',
|
||||
'ca',
|
||||
'ca_AD',
|
||||
'ca_ES',
|
||||
'ca_ES_Valencia',
|
||||
'ca_FR',
|
||||
'ca_IT',
|
||||
'ccp',
|
||||
'ccp_IN',
|
||||
'ce',
|
||||
'ce_RU',
|
||||
'cgg',
|
||||
'chr',
|
||||
'chr_US',
|
||||
'ckb',
|
||||
'cmn',
|
||||
'cmn_TW',
|
||||
'crh',
|
||||
'crh_UA',
|
||||
'cs',
|
||||
'cs_CZ',
|
||||
'csb',
|
||||
'csb_PL',
|
||||
'cu',
|
||||
'cv',
|
||||
'cv_RU',
|
||||
'cy',
|
||||
'cy_GB',
|
||||
'da',
|
||||
'da_DK',
|
||||
'da_GL',
|
||||
'dav',
|
||||
'de',
|
||||
'de_AT',
|
||||
'de_BE',
|
||||
'de_CH',
|
||||
'de_DE',
|
||||
'de_IT',
|
||||
'de_LI',
|
||||
'de_LU',
|
||||
'dje',
|
||||
'doi',
|
||||
'doi_IN',
|
||||
'dsb',
|
||||
'dsb_DE',
|
||||
'dua',
|
||||
'dv',
|
||||
'dv_MV',
|
||||
'dyo',
|
||||
'dz',
|
||||
'dz_BT',
|
||||
'ebu',
|
||||
'ee',
|
||||
'ee_TG',
|
||||
'el',
|
||||
'el_CY',
|
||||
'el_GR',
|
||||
'en',
|
||||
'en_001',
|
||||
'en_150',
|
||||
'en_AG',
|
||||
'en_AI',
|
||||
'en_AS',
|
||||
'en_AT',
|
||||
'en_AU',
|
||||
'en_BB',
|
||||
'en_BE',
|
||||
'en_BI',
|
||||
'en_BM',
|
||||
'en_BS',
|
||||
'en_BW',
|
||||
'en_BZ',
|
||||
'en_CA',
|
||||
'en_CC',
|
||||
'en_CH',
|
||||
'en_CK',
|
||||
'en_CM',
|
||||
'en_CX',
|
||||
'en_CY',
|
||||
'en_DE',
|
||||
'en_DG',
|
||||
'en_DK',
|
||||
'en_DM',
|
||||
'en_ER',
|
||||
'en_FI',
|
||||
'en_FJ',
|
||||
'en_FK',
|
||||
'en_FM',
|
||||
'en_GB',
|
||||
'en_GD',
|
||||
'en_GG',
|
||||
'en_GH',
|
||||
'en_GI',
|
||||
'en_GM',
|
||||
'en_GU',
|
||||
'en_GY',
|
||||
'en_HK',
|
||||
'en_IE',
|
||||
'en_IL',
|
||||
'en_IM',
|
||||
'en_IN',
|
||||
'en_IO',
|
||||
'en_ISO',
|
||||
'en_JE',
|
||||
'en_JM',
|
||||
'en_KE',
|
||||
'en_KI',
|
||||
'en_KN',
|
||||
'en_KY',
|
||||
'en_LC',
|
||||
'en_LR',
|
||||
'en_LS',
|
||||
'en_MG',
|
||||
'en_MH',
|
||||
'en_MO',
|
||||
'en_MP',
|
||||
'en_MS',
|
||||
'en_MT',
|
||||
'en_MU',
|
||||
'en_MW',
|
||||
'en_MY',
|
||||
'en_NA',
|
||||
'en_NF',
|
||||
'en_NG',
|
||||
'en_NL',
|
||||
'en_NR',
|
||||
'en_NU',
|
||||
'en_NZ',
|
||||
'en_PG',
|
||||
'en_PH',
|
||||
'en_PK',
|
||||
'en_PN',
|
||||
'en_PR',
|
||||
'en_PW',
|
||||
'en_RW',
|
||||
'en_SB',
|
||||
'en_SC',
|
||||
'en_SD',
|
||||
'en_SE',
|
||||
'en_SG',
|
||||
'en_SH',
|
||||
'en_SI',
|
||||
'en_SL',
|
||||
'en_SS',
|
||||
'en_SX',
|
||||
'en_SZ',
|
||||
'en_TC',
|
||||
'en_TK',
|
||||
'en_TO',
|
||||
'en_TT',
|
||||
'en_TV',
|
||||
'en_TZ',
|
||||
'en_UG',
|
||||
'en_UM',
|
||||
'en_US',
|
||||
'en_US_Posix',
|
||||
'en_VC',
|
||||
'en_VG',
|
||||
'en_VI',
|
||||
'en_VU',
|
||||
'en_WS',
|
||||
'en_ZA',
|
||||
'en_ZM',
|
||||
'en_ZW',
|
||||
'eo',
|
||||
'es',
|
||||
'es_419',
|
||||
'es_AR',
|
||||
'es_BO',
|
||||
'es_BR',
|
||||
'es_BZ',
|
||||
'es_CL',
|
||||
'es_CO',
|
||||
'es_CR',
|
||||
'es_CU',
|
||||
'es_DO',
|
||||
'es_EA',
|
||||
'es_EC',
|
||||
'es_ES',
|
||||
'es_GQ',
|
||||
'es_GT',
|
||||
'es_HN',
|
||||
'es_IC',
|
||||
'es_MX',
|
||||
'es_NI',
|
||||
'es_PA',
|
||||
'es_PE',
|
||||
'es_PH',
|
||||
'es_PR',
|
||||
'es_PY',
|
||||
'es_SV',
|
||||
'es_US',
|
||||
'es_UY',
|
||||
'es_VE',
|
||||
'et',
|
||||
'et_EE',
|
||||
'eu',
|
||||
'eu_ES',
|
||||
'ewo',
|
||||
'fa',
|
||||
'fa_AF',
|
||||
'fa_IR',
|
||||
'ff',
|
||||
'ff_CM',
|
||||
'ff_GN',
|
||||
'ff_MR',
|
||||
'ff_SN',
|
||||
'fi',
|
||||
'fi_FI',
|
||||
'fil',
|
||||
'fil_PH',
|
||||
'fo',
|
||||
'fo_DK',
|
||||
'fo_FO',
|
||||
'fr',
|
||||
'fr_BE',
|
||||
'fr_BF',
|
||||
'fr_BI',
|
||||
'fr_BJ',
|
||||
'fr_BL',
|
||||
'fr_CA',
|
||||
'fr_CD',
|
||||
'fr_CF',
|
||||
'fr_CG',
|
||||
'fr_CH',
|
||||
'fr_CI',
|
||||
'fr_CM',
|
||||
'fr_DJ',
|
||||
'fr_DZ',
|
||||
'fr_FR',
|
||||
'fr_GA',
|
||||
'fr_GF',
|
||||
'fr_GN',
|
||||
'fr_GP',
|
||||
'fr_GQ',
|
||||
'fr_HT',
|
||||
'fr_KM',
|
||||
'fr_LU',
|
||||
'fr_MA',
|
||||
'fr_MC',
|
||||
'fr_MF',
|
||||
'fr_MG',
|
||||
'fr_ML',
|
||||
'fr_MQ',
|
||||
'fr_MR',
|
||||
'fr_MU',
|
||||
'fr_NC',
|
||||
'fr_NE',
|
||||
'fr_PF',
|
||||
'fr_PM',
|
||||
'fr_RE',
|
||||
'fr_RW',
|
||||
'fr_SC',
|
||||
'fr_SN',
|
||||
'fr_SY',
|
||||
'fr_TD',
|
||||
'fr_TG',
|
||||
'fr_TN',
|
||||
'fr_VU',
|
||||
'fr_WF',
|
||||
'fr_YT',
|
||||
'fur',
|
||||
'fur_IT',
|
||||
'fy',
|
||||
'fy_DE',
|
||||
'fy_NL',
|
||||
'ga',
|
||||
'ga_IE',
|
||||
'gd',
|
||||
'gd_GB',
|
||||
'gez',
|
||||
'gez_ER',
|
||||
'gez_ET',
|
||||
'gl',
|
||||
'gl_ES',
|
||||
'gom',
|
||||
'gom_Latn',
|
||||
'gsw',
|
||||
'gsw_CH',
|
||||
'gsw_FR',
|
||||
'gsw_LI',
|
||||
'gu',
|
||||
'gu_IN',
|
||||
'guz',
|
||||
'gv',
|
||||
'gv_GB',
|
||||
'ha',
|
||||
'ha_GH',
|
||||
'ha_NE',
|
||||
'ha_NG',
|
||||
'hak',
|
||||
'hak_TW',
|
||||
'haw',
|
||||
'he',
|
||||
'he_IL',
|
||||
'hi',
|
||||
'hi_IN',
|
||||
'hif',
|
||||
'hif_FJ',
|
||||
'hne',
|
||||
'hne_IN',
|
||||
'hr',
|
||||
'hr_BA',
|
||||
'hr_HR',
|
||||
'hsb',
|
||||
'hsb_DE',
|
||||
'ht',
|
||||
'ht_HT',
|
||||
'hu',
|
||||
'hu_HU',
|
||||
'hy',
|
||||
'hy_AM',
|
||||
'i18n',
|
||||
'ia',
|
||||
'ia_FR',
|
||||
'id',
|
||||
'id_ID',
|
||||
'ig',
|
||||
'ig_NG',
|
||||
'ii',
|
||||
'ik',
|
||||
'ik_CA',
|
||||
'in',
|
||||
'is',
|
||||
'is_IS',
|
||||
'it',
|
||||
'it_CH',
|
||||
'it_IT',
|
||||
'it_SM',
|
||||
'it_VA',
|
||||
'iu',
|
||||
'iu_CA',
|
||||
'iw',
|
||||
'ja',
|
||||
'ja_JP',
|
||||
'jgo',
|
||||
'jmc',
|
||||
'jv',
|
||||
'ka',
|
||||
'ka_GE',
|
||||
'kab',
|
||||
'kab_DZ',
|
||||
'kam',
|
||||
'kde',
|
||||
'kea',
|
||||
'khq',
|
||||
'ki',
|
||||
'kk',
|
||||
'kk_KZ',
|
||||
'kkj',
|
||||
'kl',
|
||||
'kl_GL',
|
||||
'kln',
|
||||
'km',
|
||||
'km_KH',
|
||||
'kn',
|
||||
'kn_IN',
|
||||
'ko',
|
||||
'ko_KP',
|
||||
'ko_KR',
|
||||
'kok',
|
||||
'kok_IN',
|
||||
'ks',
|
||||
'ks_IN',
|
||||
'ks_IN@devanagari',
|
||||
'ksb',
|
||||
'ksf',
|
||||
'ksh',
|
||||
'ku',
|
||||
'ku_TR',
|
||||
'kw',
|
||||
'kw_GB',
|
||||
'ky',
|
||||
'ky_KG',
|
||||
'lag',
|
||||
'lb',
|
||||
'lb_LU',
|
||||
'lg',
|
||||
'lg_UG',
|
||||
'li',
|
||||
'li_NL',
|
||||
'lij',
|
||||
'lij_IT',
|
||||
'lkt',
|
||||
'ln',
|
||||
'ln_AO',
|
||||
'ln_CD',
|
||||
'ln_CF',
|
||||
'ln_CG',
|
||||
'lo',
|
||||
'lo_LA',
|
||||
'lrc',
|
||||
'lrc_IQ',
|
||||
'lt',
|
||||
'lt_LT',
|
||||
'lu',
|
||||
'luo',
|
||||
'luy',
|
||||
'lv',
|
||||
'lv_LV',
|
||||
'lzh',
|
||||
'lzh_TW',
|
||||
'mag',
|
||||
'mag_IN',
|
||||
'mai',
|
||||
'mai_IN',
|
||||
'mas',
|
||||
'mas_TZ',
|
||||
'mer',
|
||||
'mfe',
|
||||
'mfe_MU',
|
||||
'mg',
|
||||
'mg_MG',
|
||||
'mgh',
|
||||
'mgo',
|
||||
'mhr',
|
||||
'mhr_RU',
|
||||
'mi',
|
||||
'mi_NZ',
|
||||
'miq',
|
||||
'miq_NI',
|
||||
'mjw',
|
||||
'mjw_IN',
|
||||
'mk',
|
||||
'mk_MK',
|
||||
'ml',
|
||||
'ml_IN',
|
||||
'mn',
|
||||
'mn_MN',
|
||||
'mni',
|
||||
'mni_IN',
|
||||
'mo',
|
||||
'mr',
|
||||
'mr_IN',
|
||||
'ms',
|
||||
'ms_BN',
|
||||
'ms_MY',
|
||||
'ms_SG',
|
||||
'mt',
|
||||
'mt_MT',
|
||||
'mua',
|
||||
'my',
|
||||
'my_MM',
|
||||
'mzn',
|
||||
'nan',
|
||||
'nan_TW',
|
||||
'nan_TW@latin',
|
||||
'naq',
|
||||
'nb',
|
||||
'nb_NO',
|
||||
'nb_SJ',
|
||||
'nd',
|
||||
'nds',
|
||||
'nds_DE',
|
||||
'nds_NL',
|
||||
'ne',
|
||||
'ne_IN',
|
||||
'ne_NP',
|
||||
'nhn',
|
||||
'nhn_MX',
|
||||
'niu',
|
||||
'niu_NU',
|
||||
'nl',
|
||||
'nl_AW',
|
||||
'nl_BE',
|
||||
'nl_BQ',
|
||||
'nl_CW',
|
||||
'nl_NL',
|
||||
'nl_SR',
|
||||
'nl_SX',
|
||||
'nmg',
|
||||
'nn',
|
||||
'nn_NO',
|
||||
'nnh',
|
||||
'no',
|
||||
'nr',
|
||||
'nr_ZA',
|
||||
'nso',
|
||||
'nso_ZA',
|
||||
'nus',
|
||||
'nyn',
|
||||
'oc',
|
||||
'oc_FR',
|
||||
'om',
|
||||
'om_ET',
|
||||
'om_KE',
|
||||
'or',
|
||||
'or_IN',
|
||||
'os',
|
||||
'os_RU',
|
||||
'pa',
|
||||
'pa_Arab',
|
||||
'pa_Guru',
|
||||
'pa_IN',
|
||||
'pa_PK',
|
||||
'pap',
|
||||
'pap_AW',
|
||||
'pap_CW',
|
||||
'pl',
|
||||
'pl_PL',
|
||||
'prg',
|
||||
'ps',
|
||||
'ps_AF',
|
||||
'pt',
|
||||
'pt_AO',
|
||||
'pt_BR',
|
||||
'pt_CH',
|
||||
'pt_CV',
|
||||
'pt_GQ',
|
||||
'pt_GW',
|
||||
'pt_LU',
|
||||
'pt_MO',
|
||||
'pt_MZ',
|
||||
'pt_PT',
|
||||
'pt_ST',
|
||||
'pt_TL',
|
||||
'qu',
|
||||
'qu_BO',
|
||||
'qu_EC',
|
||||
'quz',
|
||||
'quz_PE',
|
||||
'raj',
|
||||
'raj_IN',
|
||||
'rm',
|
||||
'rn',
|
||||
'ro',
|
||||
'ro_MD',
|
||||
'ro_RO',
|
||||
'rof',
|
||||
'ru',
|
||||
'ru_BY',
|
||||
'ru_KG',
|
||||
'ru_KZ',
|
||||
'ru_MD',
|
||||
'ru_RU',
|
||||
'ru_UA',
|
||||
'rw',
|
||||
'rw_RW',
|
||||
'rwk',
|
||||
'sa',
|
||||
'sa_IN',
|
||||
'sah',
|
||||
'sah_RU',
|
||||
'saq',
|
||||
'sat',
|
||||
'sat_IN',
|
||||
'sbp',
|
||||
'sc',
|
||||
'sc_IT',
|
||||
'sd',
|
||||
'sd_IN',
|
||||
'sd_IN@devanagari',
|
||||
'se',
|
||||
'se_FI',
|
||||
'se_NO',
|
||||
'se_SE',
|
||||
'seh',
|
||||
'ses',
|
||||
'sg',
|
||||
'sgs',
|
||||
'sgs_LT',
|
||||
'sh',
|
||||
'shi',
|
||||
'shi_Latn',
|
||||
'shi_Tfng',
|
||||
'shn',
|
||||
'shn_MM',
|
||||
'shs',
|
||||
'shs_CA',
|
||||
'si',
|
||||
'si_LK',
|
||||
'sid',
|
||||
'sid_ET',
|
||||
'sk',
|
||||
'sk_SK',
|
||||
'sl',
|
||||
'sl_SI',
|
||||
'sm',
|
||||
'sm_WS',
|
||||
'smn',
|
||||
'sn',
|
||||
'so',
|
||||
'so_DJ',
|
||||
'so_ET',
|
||||
'so_KE',
|
||||
'so_SO',
|
||||
'sq',
|
||||
'sq_AL',
|
||||
'sq_MK',
|
||||
'sq_XK',
|
||||
'sr',
|
||||
'sr_Cyrl',
|
||||
'sr_Cyrl_BA',
|
||||
'sr_Cyrl_ME',
|
||||
'sr_Cyrl_XK',
|
||||
'sr_Latn',
|
||||
'sr_Latn_BA',
|
||||
'sr_Latn_ME',
|
||||
'sr_Latn_XK',
|
||||
'sr_ME',
|
||||
'sr_RS',
|
||||
'sr_RS@latin',
|
||||
'ss',
|
||||
'ss_ZA',
|
||||
'st',
|
||||
'st_ZA',
|
||||
'sv',
|
||||
'sv_AX',
|
||||
'sv_FI',
|
||||
'sv_SE',
|
||||
'sw',
|
||||
'sw_CD',
|
||||
'sw_KE',
|
||||
'sw_TZ',
|
||||
'sw_UG',
|
||||
'szl',
|
||||
'szl_PL',
|
||||
'ta',
|
||||
'ta_IN',
|
||||
'ta_LK',
|
||||
'ta_MY',
|
||||
'ta_SG',
|
||||
'tcy',
|
||||
'tcy_IN',
|
||||
'te',
|
||||
'te_IN',
|
||||
'teo',
|
||||
'teo_KE',
|
||||
'tet',
|
||||
'tg',
|
||||
'tg_TJ',
|
||||
'th',
|
||||
'th_TH',
|
||||
'the',
|
||||
'the_NP',
|
||||
'ti',
|
||||
'ti_ER',
|
||||
'ti_ET',
|
||||
'tig',
|
||||
'tig_ER',
|
||||
'tk',
|
||||
'tk_TM',
|
||||
'tl',
|
||||
'tl_PH',
|
||||
'tlh',
|
||||
'tn',
|
||||
'tn_ZA',
|
||||
'to',
|
||||
'to_TO',
|
||||
'tpi',
|
||||
'tpi_PG',
|
||||
'tr',
|
||||
'tr_CY',
|
||||
'tr_TR',
|
||||
'ts',
|
||||
'ts_ZA',
|
||||
'tt',
|
||||
'tt_RU',
|
||||
'tt_RU@iqtelif',
|
||||
'twq',
|
||||
'tzl',
|
||||
'tzm',
|
||||
'tzm_Latn',
|
||||
'ug',
|
||||
'ug_CN',
|
||||
'uk',
|
||||
'uk_UA',
|
||||
'unm',
|
||||
'unm_US',
|
||||
'ur',
|
||||
'ur_IN',
|
||||
'ur_PK',
|
||||
'uz',
|
||||
'uz_Arab',
|
||||
'uz_Cyrl',
|
||||
'uz_Latn',
|
||||
'uz_UZ',
|
||||
'uz_UZ@cyrillic',
|
||||
'vai',
|
||||
'vai_Latn',
|
||||
'vai_Vaii',
|
||||
've',
|
||||
've_ZA',
|
||||
'vi',
|
||||
'vi_VN',
|
||||
'vo',
|
||||
'vun',
|
||||
'wa',
|
||||
'wa_BE',
|
||||
'wae',
|
||||
'wae_CH',
|
||||
'wal',
|
||||
'wal_ET',
|
||||
'wo',
|
||||
'wo_SN',
|
||||
'xh',
|
||||
'xh_ZA',
|
||||
'xog',
|
||||
'yav',
|
||||
'yi',
|
||||
'yi_US',
|
||||
'yo',
|
||||
'yo_BJ',
|
||||
'yo_NG',
|
||||
'yue',
|
||||
'yue_HK',
|
||||
'yue_Hans',
|
||||
'yue_Hant',
|
||||
'yuw',
|
||||
'yuw_PG',
|
||||
'zgh',
|
||||
'zh',
|
||||
'zh_CN',
|
||||
'zh_HK',
|
||||
'zh_Hans',
|
||||
'zh_Hans_HK',
|
||||
'zh_Hans_MO',
|
||||
'zh_Hans_SG',
|
||||
'zh_Hant',
|
||||
'zh_Hant_HK',
|
||||
'zh_Hant_MO',
|
||||
'zh_Hant_TW',
|
||||
'zh_MO',
|
||||
'zh_SG',
|
||||
'zh_TW',
|
||||
'zh_YUE',
|
||||
'zu',
|
||||
'zu_ZA',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ use DateTimeInterface;
|
||||
* @method $this microseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method $this microsecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method $this setMicroseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method $this setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method self setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method $this addYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval).
|
||||
* @method $this addYear() Add one year to the instance (using date interval).
|
||||
* @method $this subYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
|
||||
|
||||
@@ -345,7 +345,7 @@ use DateTimeInterface;
|
||||
* @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method self setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonImmutable addYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval).
|
||||
* @method CarbonImmutable addYear() Add one year to the instance (using date interval).
|
||||
* @method CarbonImmutable subYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
|
||||
|
||||
@@ -14,6 +14,10 @@ declare(strict_types=1);
|
||||
namespace Carbon;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Carbon\Constants\DiffOptions;
|
||||
use Carbon\Constants\Format;
|
||||
use Carbon\Constants\TranslationOptions;
|
||||
use Carbon\Constants\UnitValue;
|
||||
use Carbon\Exceptions\BadComparisonUnitException;
|
||||
use Carbon\Exceptions\ImmutableException;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
@@ -361,7 +365,7 @@ use Throwable;
|
||||
* @method CarbonInterface microseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface microsecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface setMicroseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method self setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface addYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval).
|
||||
* @method CarbonInterface addYear() Add one year to the instance (using date interval).
|
||||
* @method CarbonInterface subYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
|
||||
@@ -851,127 +855,8 @@ use Throwable;
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
interface CarbonInterface extends DateTimeInterface, JsonSerializable, DiffOptions, Format, TranslationOptions, UnitValue
|
||||
{
|
||||
/**
|
||||
* Diff wording options(expressed in octal).
|
||||
*/
|
||||
public const NO_ZERO_DIFF = 01;
|
||||
public const JUST_NOW = 02;
|
||||
public const ONE_DAY_WORDS = 04;
|
||||
public const TWO_DAY_WORDS = 010;
|
||||
public const SEQUENTIAL_PARTS_ONLY = 020;
|
||||
public const ROUND = 040;
|
||||
public const FLOOR = 0100;
|
||||
public const CEIL = 0200;
|
||||
|
||||
/**
|
||||
* Diff syntax options.
|
||||
*/
|
||||
public const DIFF_ABSOLUTE = 1; // backward compatibility with true
|
||||
public const DIFF_RELATIVE_AUTO = 0; // backward compatibility with false
|
||||
public const DIFF_RELATIVE_TO_NOW = 2;
|
||||
public const DIFF_RELATIVE_TO_OTHER = 3;
|
||||
|
||||
/**
|
||||
* Translate string options.
|
||||
*/
|
||||
public const TRANSLATE_MONTHS = 1;
|
||||
public const TRANSLATE_DAYS = 2;
|
||||
public const TRANSLATE_UNITS = 4;
|
||||
public const TRANSLATE_MERIDIEM = 8;
|
||||
public const TRANSLATE_DIFF = 0x10;
|
||||
public const TRANSLATE_ALL = self::TRANSLATE_MONTHS | self::TRANSLATE_DAYS | self::TRANSLATE_UNITS | self::TRANSLATE_MERIDIEM | self::TRANSLATE_DIFF;
|
||||
|
||||
/**
|
||||
* The day constants.
|
||||
*/
|
||||
public const SUNDAY = 0;
|
||||
public const MONDAY = 1;
|
||||
public const TUESDAY = 2;
|
||||
public const WEDNESDAY = 3;
|
||||
public const THURSDAY = 4;
|
||||
public const FRIDAY = 5;
|
||||
public const SATURDAY = 6;
|
||||
|
||||
/**
|
||||
* The month constants.
|
||||
* These aren't used by Carbon itself but exist for
|
||||
* convenience sake alone.
|
||||
*/
|
||||
public const JANUARY = 1;
|
||||
public const FEBRUARY = 2;
|
||||
public const MARCH = 3;
|
||||
public const APRIL = 4;
|
||||
public const MAY = 5;
|
||||
public const JUNE = 6;
|
||||
public const JULY = 7;
|
||||
public const AUGUST = 8;
|
||||
public const SEPTEMBER = 9;
|
||||
public const OCTOBER = 10;
|
||||
public const NOVEMBER = 11;
|
||||
public const DECEMBER = 12;
|
||||
|
||||
/**
|
||||
* Number of X in Y.
|
||||
*/
|
||||
public const YEARS_PER_MILLENNIUM = 1_000;
|
||||
public const YEARS_PER_CENTURY = 100;
|
||||
public const YEARS_PER_DECADE = 10;
|
||||
public const MONTHS_PER_YEAR = 12;
|
||||
public const MONTHS_PER_QUARTER = 3;
|
||||
public const QUARTERS_PER_YEAR = 4;
|
||||
public const WEEKS_PER_YEAR = 52;
|
||||
public const WEEKS_PER_MONTH = 4;
|
||||
public const DAYS_PER_YEAR = 365;
|
||||
public const DAYS_PER_WEEK = 7;
|
||||
public const HOURS_PER_DAY = 24;
|
||||
public const MINUTES_PER_HOUR = 60;
|
||||
public const SECONDS_PER_MINUTE = 60;
|
||||
public const MILLISECONDS_PER_SECOND = 1_000;
|
||||
public const MICROSECONDS_PER_MILLISECOND = 1_000;
|
||||
public const MICROSECONDS_PER_SECOND = 1_000_000;
|
||||
|
||||
/**
|
||||
* Special settings to get the start of week from current locale culture.
|
||||
*/
|
||||
public const WEEK_DAY_AUTO = 'auto';
|
||||
|
||||
/**
|
||||
* RFC7231 DateTime format.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T';
|
||||
|
||||
/**
|
||||
* Default format to use for __toString method when type juggling occurs.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Format for converting mocked time, includes microseconds.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u';
|
||||
|
||||
/**
|
||||
* Pattern detection for ->isoFormat and ::createFromIsoFormat.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const ISO_FORMAT_REGEXP = '(O[YMDHhms]|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY?|g{1,5}|G{1,5}|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?)';
|
||||
|
||||
/**
|
||||
* Default locale (language and region).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const DEFAULT_LOCALE = 'en';
|
||||
|
||||
// <methods>
|
||||
|
||||
/**
|
||||
@@ -1054,15 +939,6 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
#[ReturnTypeWillChange]
|
||||
public static function __set_state($dump): static;
|
||||
|
||||
/**
|
||||
* Returns the list of properties to dump on serialize() called on.
|
||||
*
|
||||
* Only used by PHP < 7.4.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __sleep();
|
||||
|
||||
/**
|
||||
* Format the instance as a string using the set format
|
||||
*
|
||||
@@ -1080,9 +956,9 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
* @example $date->add(15, 'days')
|
||||
* @example $date->add(CarbonInterval::days(4))
|
||||
*
|
||||
* @param Unit|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
@@ -1358,7 +1234,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null);
|
||||
public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a Carbon instance from just a date. The time portion is set to now.
|
||||
@@ -1386,7 +1262,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
* @return static|null
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public static function createFromFormat($format, $time, $timezone = null);
|
||||
public static function createFromFormat($format, $time, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).
|
||||
@@ -1401,7 +1277,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function createFromIsoFormat(string $format, string $time, $timezone = null, ?string $locale = 'en', ?TranslatorInterface $translator = null);
|
||||
public static function createFromIsoFormat(string $format, string $time, $timezone = null, ?string $locale = 'en', ?TranslatorInterface $translator = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a Carbon instance from a specific format and a string in a given language.
|
||||
@@ -1415,7 +1291,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function createFromLocaleFormat(string $format, string $locale, string $time, $timezone = null);
|
||||
public static function createFromLocaleFormat(string $format, string $locale, string $time, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a Carbon instance from a specific ISO format and a string in a given language.
|
||||
@@ -1429,7 +1305,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function createFromLocaleIsoFormat(string $format, string $locale, string $time, $timezone = null);
|
||||
public static function createFromLocaleIsoFormat(string $format, string $locale, string $time, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a Carbon instance from just a time. The date portion is set to today.
|
||||
@@ -1457,6 +1333,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* Timestamp input can be given as int, float or a string containing one or more numbers.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public static function createFromTimestamp(string|int|float $timestamp, DateTimeZone|string|int|null $timezone = null): static;
|
||||
|
||||
/**
|
||||
@@ -1525,7 +1402,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null);
|
||||
public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Create a new Carbon instance from a specific date and time using strict validation.
|
||||
@@ -2147,13 +2024,22 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
/**
|
||||
* Create an instance from a serialized string.
|
||||
*
|
||||
* @param string $value
|
||||
* If $value is not from a trusted source, consider using the allowed_classes option to limit
|
||||
* the types of objects that can be built, for instance:
|
||||
*
|
||||
* @example
|
||||
* ```php
|
||||
* $object = Carbon::fromSerialized($value, ['allowed_classes' => [Carbon::class, CarbonImmutable::class]]);
|
||||
* ```
|
||||
*
|
||||
* @param \Stringable|string $value
|
||||
* @param array $options example: ['allowed_classes' => [CarbonImmutable::class]]
|
||||
*
|
||||
* @throws InvalidFormatException
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function fromSerialized($value): static;
|
||||
public static function fromSerialized($value, array $options = []): static;
|
||||
|
||||
/**
|
||||
* Register a custom macro.
|
||||
@@ -3376,7 +3262,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
* echo Carbon::yesterday()->hours(11)->userFormat();
|
||||
* ```
|
||||
*
|
||||
* @param-closure-this static $macro
|
||||
* @param-closure-this static $macro
|
||||
*/
|
||||
public static function macro(string $name, ?callable $macro): void;
|
||||
|
||||
@@ -3392,7 +3278,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function make($var, DateTimeZone|string|null $timezone = null);
|
||||
public static function make($var, DateTimeZone|string|null $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* Get the maximum instance between a given instance (default now) and the current instance.
|
||||
@@ -3678,7 +3564,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
public static function rawCreateFromFormat(string $format, string $time, $timezone = null);
|
||||
public static function rawCreateFromFormat(string $format, string $time, $timezone = null): ?static;
|
||||
|
||||
/**
|
||||
* @see https://php.net/manual/en/datetime.format.php
|
||||
@@ -4232,9 +4118,9 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
* @example $date->sub(15, 'days')
|
||||
* @example $date->sub(CarbonInterval::days(4))
|
||||
*
|
||||
* @param Unit|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
@@ -4284,9 +4170,9 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
*
|
||||
* @see sub()
|
||||
*
|
||||
* @param string|DateInterval $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
@@ -4755,7 +4641,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
public static function translateTimeString(string $timeString, ?string $from = null, ?string $to = null, int $mode = self::TRANSLATE_ALL): string;
|
||||
|
||||
/**
|
||||
* Translate a time string from the current locale (`$date->locale()`) to an other.
|
||||
* Translate a time string from the current locale (`$date->locale()`) to another one.
|
||||
*
|
||||
* @param string $timeString time string to translate
|
||||
* @param string|null $to output locale of the result returned ("en" by default)
|
||||
@@ -4784,6 +4670,8 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
|
||||
|
||||
/**
|
||||
* Set the timezone or returns the timezone name if no arguments passed.
|
||||
*
|
||||
* @return ($value is null ? string : static)
|
||||
*/
|
||||
public function tz(DateTimeZone|string|int|null $value = null): static|string;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Carbon;
|
||||
|
||||
use Carbon\Constants\UnitValue;
|
||||
use Carbon\Exceptions\BadFluentConstructorException;
|
||||
use Carbon\Exceptions\BadFluentSetterException;
|
||||
use Carbon\Exceptions\InvalidCastException;
|
||||
@@ -191,7 +192,7 @@ use Throwable;
|
||||
* @method $this ceilMicrosecond(int|float $precision = 1) Ceil the current instance microsecond with given precision.
|
||||
* @method $this ceilMicroseconds(int|float $precision = 1) Ceil the current instance microsecond with given precision.
|
||||
*/
|
||||
class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
class CarbonInterval extends DateInterval implements CarbonConverterInterface, UnitValue
|
||||
{
|
||||
use LocalFactory;
|
||||
use IntervalRounding;
|
||||
|
||||
@@ -13,6 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Carbon;
|
||||
|
||||
use Carbon\Constants\UnitValue;
|
||||
use Carbon\Exceptions\EndLessPeriodException;
|
||||
use Carbon\Exceptions\InvalidCastException;
|
||||
use Carbon\Exceptions\InvalidIntervalException;
|
||||
@@ -180,7 +181,7 @@ require PHP_VERSION < 8.2
|
||||
* @SuppressWarnings(CamelCasePropertyName)
|
||||
* @SuppressWarnings(CouplingBetweenObjects)
|
||||
*/
|
||||
class CarbonPeriod extends DatePeriodBase implements Countable, JsonSerializable
|
||||
class CarbonPeriod extends DatePeriodBase implements Countable, JsonSerializable, UnitValue
|
||||
{
|
||||
use LocalFactory;
|
||||
use IntervalRounding;
|
||||
|
||||
37
plugins/vendor/nesbot/carbon/src/Carbon/Constants/DiffOptions.php
vendored
Normal file
37
plugins/vendor/nesbot/carbon/src/Carbon/Constants/DiffOptions.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carbon\Constants;
|
||||
|
||||
interface DiffOptions
|
||||
{
|
||||
/**
|
||||
* Diff wording options(expressed in octal).
|
||||
*/
|
||||
public const NO_ZERO_DIFF = 01;
|
||||
public const JUST_NOW = 02;
|
||||
public const ONE_DAY_WORDS = 04;
|
||||
public const TWO_DAY_WORDS = 010;
|
||||
public const SEQUENTIAL_PARTS_ONLY = 020;
|
||||
public const ROUND = 040;
|
||||
public const FLOOR = 0100;
|
||||
public const CEIL = 0200;
|
||||
|
||||
/**
|
||||
* Diff syntax options.
|
||||
*/
|
||||
public const DIFF_ABSOLUTE = 1; // backward compatibility with true
|
||||
public const DIFF_RELATIVE_AUTO = 0; // backward compatibility with false
|
||||
public const DIFF_RELATIVE_TO_NOW = 2;
|
||||
public const DIFF_RELATIVE_TO_OTHER = 3;
|
||||
}
|
||||
45
plugins/vendor/nesbot/carbon/src/Carbon/Constants/Format.php
vendored
Normal file
45
plugins/vendor/nesbot/carbon/src/Carbon/Constants/Format.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carbon\Constants;
|
||||
|
||||
interface Format
|
||||
{
|
||||
/**
|
||||
* RFC7231 DateTime format.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T';
|
||||
|
||||
/**
|
||||
* Default format to use for __toString method when type juggling occurs.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Format for converting mocked time, includes microseconds.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u';
|
||||
|
||||
/**
|
||||
* Pattern detection for ->isoFormat and ::createFromIsoFormat.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const ISO_FORMAT_REGEXP = '(O[YMDHhms]|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY?|g{1,5}|G{1,5}|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?)';
|
||||
}
|
||||
39
plugins/vendor/nesbot/carbon/src/Carbon/Constants/TranslationOptions.php
vendored
Normal file
39
plugins/vendor/nesbot/carbon/src/Carbon/Constants/TranslationOptions.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carbon\Constants;
|
||||
|
||||
interface TranslationOptions
|
||||
{
|
||||
/**
|
||||
* Translate string options.
|
||||
*/
|
||||
public const TRANSLATE_MONTHS = 1;
|
||||
public const TRANSLATE_DAYS = 2;
|
||||
public const TRANSLATE_UNITS = 4;
|
||||
public const TRANSLATE_MERIDIEM = 8;
|
||||
public const TRANSLATE_DIFF = 0x10;
|
||||
public const TRANSLATE_ALL = self::TRANSLATE_MONTHS | self::TRANSLATE_DAYS | self::TRANSLATE_UNITS | self::TRANSLATE_MERIDIEM | self::TRANSLATE_DIFF;
|
||||
|
||||
/**
|
||||
* Special settings to get the start of week from current locale culture.
|
||||
*/
|
||||
public const WEEK_DAY_AUTO = 'auto';
|
||||
|
||||
/**
|
||||
* Default locale (language and region).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const DEFAULT_LOCALE = 'en';
|
||||
}
|
||||
66
plugins/vendor/nesbot/carbon/src/Carbon/Constants/UnitValue.php
vendored
Normal file
66
plugins/vendor/nesbot/carbon/src/Carbon/Constants/UnitValue.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Carbon\Constants;
|
||||
|
||||
interface UnitValue
|
||||
{
|
||||
/**
|
||||
* The day constants.
|
||||
*/
|
||||
public const SUNDAY = 0;
|
||||
public const MONDAY = 1;
|
||||
public const TUESDAY = 2;
|
||||
public const WEDNESDAY = 3;
|
||||
public const THURSDAY = 4;
|
||||
public const FRIDAY = 5;
|
||||
public const SATURDAY = 6;
|
||||
|
||||
/**
|
||||
* The month constants.
|
||||
* These aren't used by Carbon itself but exist for
|
||||
* convenience's sake alone.
|
||||
*/
|
||||
public const JANUARY = 1;
|
||||
public const FEBRUARY = 2;
|
||||
public const MARCH = 3;
|
||||
public const APRIL = 4;
|
||||
public const MAY = 5;
|
||||
public const JUNE = 6;
|
||||
public const JULY = 7;
|
||||
public const AUGUST = 8;
|
||||
public const SEPTEMBER = 9;
|
||||
public const OCTOBER = 10;
|
||||
public const NOVEMBER = 11;
|
||||
public const DECEMBER = 12;
|
||||
|
||||
/**
|
||||
* Number of X in Y.
|
||||
*/
|
||||
public const YEARS_PER_MILLENNIUM = 1_000;
|
||||
public const YEARS_PER_CENTURY = 100;
|
||||
public const YEARS_PER_DECADE = 10;
|
||||
public const MONTHS_PER_YEAR = 12;
|
||||
public const MONTHS_PER_QUARTER = 3;
|
||||
public const QUARTERS_PER_YEAR = 4;
|
||||
public const WEEKS_PER_YEAR = 52;
|
||||
public const WEEKS_PER_MONTH = 4;
|
||||
public const DAYS_PER_YEAR = 365;
|
||||
public const DAYS_PER_WEEK = 7;
|
||||
public const HOURS_PER_DAY = 24;
|
||||
public const MINUTES_PER_HOUR = 60;
|
||||
public const SECONDS_PER_MINUTE = 60;
|
||||
public const MILLISECONDS_PER_SECOND = 1_000;
|
||||
public const MICROSECONDS_PER_MILLISECOND = 1_000;
|
||||
public const MICROSECONDS_PER_SECOND = 1_000_000;
|
||||
}
|
||||
@@ -65,7 +65,9 @@ use Throwable;
|
||||
* @method Carbon createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null) Create a new Carbon instance from a specific date and time using strict validation.
|
||||
* @method mixed executeWithLocale(string $locale, callable $func) Set the current locale to the given, execute the passed function, reset the locale to previous one,
|
||||
* then return the result of the closure (or null if the closure was void).
|
||||
* @method Carbon fromSerialized($value) Create an instance from a serialized string.
|
||||
* @method Carbon fromSerialized($value, array $options = []) Create an instance from a serialized string.
|
||||
* If $value is not from a trusted source, consider using the allowed_classes option to limit
|
||||
* the types of objects that can be built, for instance:
|
||||
* @method array getAvailableLocales() Returns the list of internally available locales and already loaded custom locales.
|
||||
* (It will ignore custom translator dynamic loading.)
|
||||
* @method Language[] getAvailableLocalesInfo() Returns list of Language object for each available locale. This object allow you to get the ISO name, native
|
||||
@@ -639,12 +641,13 @@ class Factory
|
||||
*/
|
||||
public function withTestNow(mixed $testNow, callable $callback): mixed
|
||||
{
|
||||
$previousTestNow = $this->getTestNow();
|
||||
$this->setTestNow($testNow);
|
||||
|
||||
try {
|
||||
$result = $callback();
|
||||
} finally {
|
||||
$this->setTestNow();
|
||||
$this->setTestNow($previousTestNow);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -62,7 +62,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
* @method CarbonImmutable createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null) Create a new Carbon instance from a specific date and time using strict validation.
|
||||
* @method mixed executeWithLocale(string $locale, callable $func) Set the current locale to the given, execute the passed function, reset the locale to previous one,
|
||||
* then return the result of the closure (or null if the closure was void).
|
||||
* @method CarbonImmutable fromSerialized($value) Create an instance from a serialized string.
|
||||
* @method CarbonImmutable fromSerialized($value, array $options = []) Create an instance from a serialized string.
|
||||
* If $value is not from a trusted source, consider using the allowed_classes option to limit
|
||||
* the types of objects that can be built, for instance:
|
||||
* @method array getAvailableLocales() Returns the list of internally available locales and already loaded custom locales.
|
||||
* (It will ignore custom translator dynamic loading.)
|
||||
* @method Language[] getAvailableLocalesInfo() Returns list of Language object for each available locale. This object allow you to get the ISO name, native
|
||||
|
||||
@@ -119,7 +119,6 @@ return [
|
||||
},
|
||||
'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
|
||||
'months_short' => ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
|
||||
'months_standalone' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'],
|
||||
'weekdays' => ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'],
|
||||
'weekdays_short' => ['baz', 'bze', 'çax', 'çər', 'cax', 'cüm', 'şən'],
|
||||
'weekdays_min' => ['bz', 'be', 'ça', 'çə', 'ca', 'cü', 'şə'],
|
||||
|
||||
27
plugins/vendor/nesbot/carbon/src/Carbon/Lang/az_Arab.php
vendored
Normal file
27
plugins/vendor/nesbot/carbon/src/Carbon/Lang/az_Arab.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* - Mousa Moradi mousamk@gmail.com
|
||||
*/
|
||||
return array_replace_recursive(require __DIR__.'/en.php', [
|
||||
'formats' => [
|
||||
'L' => 'OY/OM/OD',
|
||||
],
|
||||
'months' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مئی', 'ژوئن', 'جولای', 'آقۇست', 'سپتامبر', 'اوْکتوْبر', 'نوْوامبر', 'دسامبر'],
|
||||
'months_short' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مئی', 'ژوئن', 'جولای', 'آقۇست', 'سپتامبر', 'اوْکتوْبر', 'نوْوامبر', 'دسامبر'],
|
||||
'weekdays' => ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'],
|
||||
'weekdays_short' => ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'],
|
||||
'weekdays_min' => ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'],
|
||||
'first_day_of_week' => 6,
|
||||
'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹'],
|
||||
]);
|
||||
@@ -15,6 +15,5 @@ return array_replace_recursive(require __DIR__.'/az.php', [
|
||||
'weekdays_min' => ['Б.', 'Б.Е.', 'Ч.А.', 'Ч.', 'Ҹ.А.', 'Ҹ.', 'Ш.'],
|
||||
'months' => ['јанвар', 'феврал', 'март', 'апрел', 'май', 'ијун', 'ијул', 'август', 'сентјабр', 'октјабр', 'нојабр', 'декабр'],
|
||||
'months_short' => ['јан', 'фев', 'мар', 'апр', 'май', 'ијн', 'ијл', 'авг', 'сен', 'окт', 'ној', 'дек'],
|
||||
'months_standalone' => ['Јанвар', 'Феврал', 'Март', 'Апрел', 'Май', 'Ијун', 'Ијул', 'Август', 'Сентјабр', 'Октјабр', 'Нојабр', 'Декабр'],
|
||||
'meridiem' => ['а', 'п'],
|
||||
]);
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* - Mousa Moradi mousamk@gmail.com
|
||||
*/
|
||||
return array_replace_recursive(require __DIR__.'/en.php', [
|
||||
'formats' => [
|
||||
'L' => 'OY/OM/OD',
|
||||
|
||||
@@ -16,7 +16,6 @@ return array_replace_recursive(require __DIR__.'/az.php', [
|
||||
'weekdays_min' => ['B.', 'B.E.', 'Ç.A.', 'Ç.', 'C.A.', 'C.', 'Ş.'],
|
||||
'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'],
|
||||
'months_short' => ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'],
|
||||
'months_standalone' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'],
|
||||
'first_day_of_week' => 1,
|
||||
'formats' => [
|
||||
'LT' => 'HH:mm',
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$bengaliNumbers = ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'];
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* - Josh Soref
|
||||
@@ -18,6 +20,7 @@
|
||||
* - JD Isaacks
|
||||
* - Saiful Islam
|
||||
* - Faisal Islam
|
||||
* - Hayatunnabi Nabil
|
||||
*/
|
||||
return [
|
||||
'year' => ':count বছর',
|
||||
@@ -41,6 +44,12 @@ return [
|
||||
'second' => ':count সেকেন্ড',
|
||||
'a_second' => 'কয়েক সেকেন্ড|:count সেকেন্ড',
|
||||
's' => '১ সেকেন্ড|:count সেকেন্ড',
|
||||
'millisecond' => ':count মিলিসেকেন্ড',
|
||||
'a_millisecond' => 'এক মিলিসেকেন্ড|:count মিলিসেকেন্ড',
|
||||
'ms' => '১ মিলিসেকেন্ড|:count মিলিসেকেন্ড',
|
||||
'microsecond' => ':count মাইক্রোসেকেন্ড',
|
||||
'a_microsecond' => 'এক মাইক্রোসেকেন্ড|:count মাইক্রোসেকেন্ড',
|
||||
'µs' => '১ মাইক্রোসেকেন্ড|:count মাইক্রোসেকেন্ড',
|
||||
'ago' => ':time আগে',
|
||||
'from_now' => ':time পরে',
|
||||
'after' => ':time পরে',
|
||||
@@ -49,6 +58,8 @@ return [
|
||||
'diff_today' => 'আজ',
|
||||
'diff_yesterday' => 'গতকাল',
|
||||
'diff_tomorrow' => 'আগামীকাল',
|
||||
'diff_before_yesterday' => 'গত পরশু',
|
||||
'diff_after_tomorrow' => 'আগামী পরশু',
|
||||
'period_recurrences' => ':count বার|:count বার',
|
||||
'period_interval' => 'প্রতি :interval',
|
||||
'period_start_date' => ':date থেকে',
|
||||
@@ -90,11 +101,53 @@ return [
|
||||
'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'],
|
||||
'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'],
|
||||
'weekdays_min' => ['রবি', 'সোম', 'মঙ্গ', 'বুধ', 'বৃহঃ', 'শুক্র', 'শনি'],
|
||||
'ordinal' => static function ($number) use ($bengaliNumbers) {
|
||||
// Convert to Bengali numerals
|
||||
$bengaliNumber = str_replace(
|
||||
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
$bengaliNumbers,
|
||||
(string) $number
|
||||
);
|
||||
|
||||
// Apply Bengali ordinal rules
|
||||
$lastDigit = $number % 10;
|
||||
$lastTwoDigits = $number % 100;
|
||||
|
||||
// Special cases for teens (11-19) always use তম
|
||||
if ($lastTwoDigits >= 11 && $lastTwoDigits <= 19) {
|
||||
return $bengaliNumber.'তম';
|
||||
}
|
||||
|
||||
// For numbers 1-10, use specific rules
|
||||
if ($number <= 10) {
|
||||
switch ($number) {
|
||||
case 1:
|
||||
case 5:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
return $bengaliNumber.'ম';
|
||||
case 2:
|
||||
case 3:
|
||||
return $bengaliNumber.'য়';
|
||||
case 4:
|
||||
return $bengaliNumber.'র্থ';
|
||||
case 6:
|
||||
return $bengaliNumber.'ষ্ঠ';
|
||||
default:
|
||||
return $bengaliNumber.'তম';
|
||||
}
|
||||
}
|
||||
|
||||
// For numbers > 20, all use তম
|
||||
return $bengaliNumber.'তম';
|
||||
},
|
||||
'list' => [', ', ' এবং '],
|
||||
'first_day_of_week' => 0,
|
||||
'day_of_first_week_of_year' => 1,
|
||||
'weekdays_standalone' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহষ্পতিবার', 'শুক্রবার', 'শনিবার'],
|
||||
'weekdays_min_standalone' => ['রঃ', 'সোঃ', 'মঃ', 'বুঃ', 'বৃঃ', 'শুঃ', 'শনি'],
|
||||
'months_short_standalone' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
|
||||
'alt_numbers' => ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'],
|
||||
'alt_numbers' => $bengaliNumbers,
|
||||
];
|
||||
|
||||
@@ -44,10 +44,17 @@ return [
|
||||
'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα',
|
||||
'a_second' => 'λίγα δευτερόλεπτα|:count δευτερόλεπτα',
|
||||
's' => ':count δευ.',
|
||||
|
||||
'ago' => 'πριν :time',
|
||||
'from_now' => 'σε :time',
|
||||
'after' => ':time μετά',
|
||||
'before' => ':time πριν',
|
||||
|
||||
'year_ago' => ':count χρόνο|:count χρόνια',
|
||||
'year_from_now' => ':count χρόνο|:count χρόνια',
|
||||
'month_ago' => ':count μήνα|:count μήνες',
|
||||
'month_from_now' => ':count μήνα|:count μήνες',
|
||||
|
||||
'diff_now' => 'τώρα',
|
||||
'diff_today' => 'Σήμερα',
|
||||
'diff_today_regexp' => 'Σήμερα(?:\\s+{})?',
|
||||
@@ -55,6 +62,7 @@ return [
|
||||
'diff_yesterday_regexp' => 'Χθες(?:\\s+{})?',
|
||||
'diff_tomorrow' => 'αύριο',
|
||||
'diff_tomorrow_regexp' => 'Αύριο(?:\\s+{})?',
|
||||
|
||||
'formats' => [
|
||||
'LT' => 'h:mm A',
|
||||
'LTS' => 'h:mm:ss A',
|
||||
|
||||
@@ -92,4 +92,5 @@ return [
|
||||
'list' => [', ', ' and '],
|
||||
'first_day_of_week' => 1,
|
||||
'day_of_first_week_of_year' => 1,
|
||||
'meridiem' => ['AM', 'PM'],
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Authors:
|
||||
* - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandriva.com
|
||||
*/
|
||||
return array_replace_recursive(require __DIR__.'/en.php', [
|
||||
return array_replace_recursive(require __DIR__.'/fy.php', [
|
||||
'formats' => [
|
||||
'L' => 'DD.MM.YYYY',
|
||||
],
|
||||
|
||||
@@ -22,6 +22,4 @@ return array_replace_recursive(require __DIR__.'/fy.php', [
|
||||
'weekdays' => ['Snein', 'Moandei', 'Tiisdei', 'Woansdei', 'Tongersdei', 'Freed', 'Sneon'],
|
||||
'weekdays_short' => ['Sn', 'Mo', 'Ti', 'Wo', 'To', 'Fr', 'Sn'],
|
||||
'weekdays_min' => ['Sn', 'Mo', 'Ti', 'Wo', 'To', 'Fr', 'Sn'],
|
||||
'first_day_of_week' => 1,
|
||||
'day_of_first_week_of_year' => 4,
|
||||
]);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Authors:
|
||||
* - bug-glibc-locales@gnu.org
|
||||
*/
|
||||
return array_replace_recursive(require __DIR__.'/en.php', [
|
||||
return array_replace_recursive(require __DIR__.'/pa_Arab.php', [
|
||||
'formats' => [
|
||||
'L' => 'DD/MM/YYYY',
|
||||
],
|
||||
|
||||
@@ -119,8 +119,10 @@ return [
|
||||
},
|
||||
'sameElse' => 'L',
|
||||
],
|
||||
'months' => ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
|
||||
'months' => ['januarja', 'februarja', 'marca', 'aprila', 'maja', 'junija', 'julija', 'avgusta', 'septembra', 'oktobra', 'novembra', 'decembra'],
|
||||
'months_standalone' => ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
|
||||
'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
|
||||
'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/',
|
||||
'weekdays' => ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
|
||||
'weekdays_short' => ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
|
||||
'weekdays_min' => ['ne', 'po', 'to', 'sr', 'če', 'pe', 'so'],
|
||||
|
||||
@@ -14,42 +14,59 @@
|
||||
* - http://www.uyip.org/ Pablo Saratxaga pablo@mandrakesoft.com
|
||||
*/
|
||||
return array_replace_recursive(require __DIR__.'/en.php', [
|
||||
'year' => '{1}:count יאר|{0}:count יאר|[-Inf,Inf]:count יאר',
|
||||
'a_year' => '{1}א יאר|{0}:count יאר|[-Inf,Inf]:count יאר',
|
||||
'y' => ':count יאר',
|
||||
'month' => '{1}:count חודש|{0}:count חדשים|[-Inf,Inf]:count חדשים',
|
||||
'a_month' => '{1}א חודש|{0}:count חדשים|[-Inf,Inf]:count חדשים',
|
||||
'm' => '{1}:count חודש|{0}:count חדשים|[-Inf,Inf]:count חדשים',
|
||||
'week' => '{1}:count וואך|{0}:count וואכן|[-Inf,Inf]:count וואכן',
|
||||
'a_week' => '{1}א וואך|{0}:count וואכן|[-Inf,Inf]:count וואכן',
|
||||
'w' => ':count וואך',
|
||||
'day' => '{1}:count טאג|{0}:count טעג|[-Inf,Inf]:count טעג',
|
||||
'a_day' => '{1}א טאג|{0}:count טעג|[-Inf,Inf]:count טעג',
|
||||
'd' => ':count טאג',
|
||||
'hour' => ':count שעה',
|
||||
'a_hour' => 'א שעה',
|
||||
'h' => ':count שעה',
|
||||
'minute' => '{1}:count מינוט|{0}:count מינוט|[-Inf,Inf]:count מינוט',
|
||||
'a_minute' => '{1}א מינוט|{0}:count מינוט|[-Inf,Inf]:count מינוט',
|
||||
'min' => ':count מינוט',
|
||||
'second' => '{1}:count סעקונדע|{0}:count סעקונדעס|[-Inf,Inf]:count סעקונדעס',
|
||||
'a_second' => '{0,1}א סעקונדע|[-Inf,Inf]:count סעקונדעס',
|
||||
's' => ':count סעק',
|
||||
'millisecond' => '{1}:count מילי-סעקונדע|{0}:count מילי-סעקונדעס|[-Inf,Inf]:count מילי-סעקונדעס',
|
||||
'a_millisecond' => '{1}א מילי-סעקונדע|{0}:count מילי-סעקונדעס|[-Inf,Inf]:count מילי-סעקונדעס',
|
||||
'ms' => ':count מס',
|
||||
'microsecond' => '{1}:count מיקרא-סעקונדע|{0}:count מיקרא-סעקונדעס|[-Inf,Inf]:count מיקרא-סעקונדעס',
|
||||
'a_microsecond' => '{1}א מיקרא-סעקונדע|{0}:count מיקרא-סעקונדעס|[-Inf,Inf]:count מיקרא-סעקונדעס',
|
||||
'µs' => ':count מיקרא',
|
||||
'ago' => ':time פון יעצט',
|
||||
'from_now' => ':time ארום',
|
||||
'after' => ':time נאך',
|
||||
'before' => ':time פאר',
|
||||
'diff_now' => 'ממש יעצט',
|
||||
'diff_today' => 'היינט',
|
||||
'diff_yesterday' => 'נעכטן',
|
||||
'diff_tomorrow' => 'מארגן',
|
||||
'diff_before_yesterday' => 'אייער-נעכטן',
|
||||
'diff_after_tomorrow' => 'איבער-מארגן',
|
||||
'period_recurrences' => '{1}איין מאל|{0}:count מאל|[-Inf,Inf]:count מאל',
|
||||
'period_interval' => 'יעדע :interval',
|
||||
'period_start_date' => 'פון :date',
|
||||
'period_end_date' => 'ביז :date',
|
||||
'months' => ['יאנואר', 'פעברואר', 'מארטש', 'אפריל', 'מאי', 'יוני', 'יולי', 'אויגוסט', 'סעפטעמבער', 'אקטאבער', 'נאוועמבער', 'דעצעמבער'],
|
||||
'months_short' => ['יאנ\'', 'פעב\'', 'מאר\'', 'אפר\'', 'מאי', 'יוני', 'יולי', 'אויג\'', 'סעפ\'', 'אקט\'', 'נאו\'', 'דעצ\''],
|
||||
'weekdays' => ['זונטאג', 'מאנטאג', 'דינסטאג', 'מיטוואך', 'דאנערשטאג', 'פרייטאג', 'שבת'],
|
||||
'weekdays_short' => ['זונ\'', 'מאנ\'', 'דינ\'', 'מיט\'', 'דאנ\'', 'פריי\'', 'שבת'],
|
||||
'weekdays_min' => ['ז\'', 'מ\'', 'ד\'', 'מ\'', 'ד\'', 'ו\'', 'ש\''],
|
||||
'ordinal' => static function ($number) {
|
||||
return $number.'טע';
|
||||
},
|
||||
'list' => [', ', ' און '],
|
||||
'formats' => [
|
||||
'L' => 'DD/MM/YY',
|
||||
],
|
||||
'months' => ['יאַנואַר', 'פֿעברואַר', 'מערץ', 'אַפּריל', 'מיי', 'יוני', 'יולי', 'אויגוסט', 'סעפּטעמבער', 'אקטאבער', 'נאוועמבער', 'דעצעמבער'],
|
||||
'months_short' => ['יאַנ', 'פֿעב', 'מאַר', 'אַפּר', 'מײַ ', 'יונ', 'יול', 'אױג', 'סעפּ', 'אָקט', 'נאָװ', 'דעצ'],
|
||||
'weekdays' => ['זונטיק', 'מאָנטיק', 'דינסטיק', 'מיטװאָך', 'דאָנערשטיק', 'פֿרײַטיק', 'שבת'],
|
||||
'weekdays_short' => ['זונ\'', 'מאָנ\'', 'דינ\'', 'מיט\'', 'דאָנ\'', 'פֿרײַ\'', 'שבת'],
|
||||
'weekdays_min' => ['זונ\'', 'מאָנ\'', 'דינ\'', 'מיט\'', 'דאָנ\'', 'פֿרײַ\'', 'שבת'],
|
||||
'first_day_of_week' => 0,
|
||||
'day_of_first_week_of_year' => 1,
|
||||
|
||||
'year' => ':count יאר',
|
||||
'y' => ':count יאר',
|
||||
'a_year' => ':count יאר',
|
||||
|
||||
'month' => ':count חודש',
|
||||
'm' => ':count חודש',
|
||||
'a_month' => ':count חודש',
|
||||
|
||||
'week' => ':count וואָך',
|
||||
'w' => ':count וואָך',
|
||||
'a_week' => ':count וואָך',
|
||||
|
||||
'day' => ':count טאָג',
|
||||
'd' => ':count טאָג',
|
||||
'a_day' => ':count טאָג',
|
||||
|
||||
'hour' => ':count שעה',
|
||||
'h' => ':count שעה',
|
||||
'a_hour' => ':count שעה',
|
||||
|
||||
'minute' => ':count מינוט',
|
||||
'min' => ':count מינוט',
|
||||
'a_minute' => ':count מינוט',
|
||||
|
||||
'second' => ':count סעקונדע',
|
||||
's' => ':count סעקונדע',
|
||||
'a_second' => ':count סעקונדע',
|
||||
]);
|
||||
|
||||
@@ -596,7 +596,7 @@ return [
|
||||
'nativeName' => 'Slovenčina, Slovenský Jazyk',
|
||||
],
|
||||
'sl' => [
|
||||
'isoName' => 'Slovene',
|
||||
'isoName' => 'Slovenian',
|
||||
'nativeName' => 'Slovenski Jezik, Slovenščina',
|
||||
],
|
||||
'so' => [
|
||||
|
||||
@@ -50,7 +50,7 @@ trait Creator
|
||||
/**
|
||||
* The errors that can occur.
|
||||
*/
|
||||
protected static ?array $lastErrors = null;
|
||||
protected static array|bool $lastErrors = false;
|
||||
|
||||
/**
|
||||
* Create a new Carbon instance.
|
||||
@@ -905,14 +905,7 @@ trait Creator
|
||||
*/
|
||||
private static function setLastErrors($lastErrors): void
|
||||
{
|
||||
if (\is_array($lastErrors) || $lastErrors === false) {
|
||||
static::$lastErrors = \is_array($lastErrors) ? $lastErrors : [
|
||||
'warning_count' => 0,
|
||||
'warnings' => [],
|
||||
'error_count' => 0,
|
||||
'errors' => [],
|
||||
];
|
||||
}
|
||||
static::$lastErrors = $lastErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -920,7 +913,7 @@ trait Creator
|
||||
*/
|
||||
public static function getLastErrors(): array|false
|
||||
{
|
||||
return static::$lastErrors ?? false;
|
||||
return static::$lastErrors;
|
||||
}
|
||||
|
||||
private static function monthToInt(mixed $value, string $unit = 'month'): mixed
|
||||
|
||||
@@ -372,7 +372,7 @@ use Throwable;
|
||||
* @method CarbonInterface microseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface microsecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface setMicroseconds(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method self setMicrosecond(int $value) Set current instance microsecond to the given value.
|
||||
* @method CarbonInterface addYears(int|float $value = 1) Add years (the $value count passed in) to the instance (using date interval).
|
||||
* @method CarbonInterface addYear() Add one year to the instance (using date interval).
|
||||
* @method CarbonInterface subYears(int|float $value = 1) Sub years (the $value count passed in) to the instance (using date interval).
|
||||
@@ -2670,7 +2670,7 @@ trait Date
|
||||
protected function getTranslatedFormByRegExp($baseKey, $keySuffix, $context, $subKey, $defaultValue)
|
||||
{
|
||||
$key = $baseKey.$keySuffix;
|
||||
$standaloneKey = "{$key}_standalone";
|
||||
$standaloneKey = $key.'_standalone';
|
||||
$baseTranslation = $this->getTranslationMessage($key);
|
||||
|
||||
if ($baseTranslation instanceof Closure) {
|
||||
@@ -2679,7 +2679,7 @@ trait Date
|
||||
|
||||
if (
|
||||
$this->getTranslationMessage("$standaloneKey.$subKey") &&
|
||||
(!$context || (($regExp = $this->getTranslationMessage("{$baseKey}_regexp")) && !preg_match($regExp, $context)))
|
||||
(!$context || (($regExp = $this->getTranslationMessage($baseKey.'_regexp')) && !preg_match($regExp, $context)))
|
||||
) {
|
||||
$key = $standaloneKey;
|
||||
}
|
||||
|
||||
@@ -275,18 +275,18 @@ trait Localization
|
||||
|
||||
if ($list) {
|
||||
foreach ($$variable as $index => &$name) {
|
||||
$name .= '|'.$messages[$variable.'_standalone'][$index];
|
||||
$name .= '|'.$list[$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$$translationKey = array_merge(
|
||||
$mode & CarbonInterface::TRANSLATE_MONTHS ? static::getTranslationArray($months, static::MONTHS_PER_YEAR, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_MONTHS ? static::getTranslationArray($messages['months_short'] ?? [], static::MONTHS_PER_YEAR, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DAYS ? static::getTranslationArray($weekdays, static::DAYS_PER_WEEK, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DAYS ? static::getTranslationArray($messages['weekdays_short'] ?? [], static::DAYS_PER_WEEK, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DIFF ? static::translateWordsByKeys([
|
||||
$mode & CarbonInterface::TRANSLATE_MONTHS ? self::getTranslationArray($months, static::MONTHS_PER_YEAR, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_MONTHS ? self::getTranslationArray($messages['months_short'] ?? [], static::MONTHS_PER_YEAR, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DAYS ? self::getTranslationArray($weekdays, static::DAYS_PER_WEEK, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DAYS ? self::getTranslationArray($messages['weekdays_short'] ?? [], static::DAYS_PER_WEEK, $timeString) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_DIFF ? self::translateWordsByKeys([
|
||||
'diff_now',
|
||||
'diff_today',
|
||||
'diff_yesterday',
|
||||
@@ -294,7 +294,7 @@ trait Localization
|
||||
'diff_before_yesterday',
|
||||
'diff_after_tomorrow',
|
||||
], $messages, $key) : [],
|
||||
$mode & CarbonInterface::TRANSLATE_UNITS ? static::translateWordsByKeys([
|
||||
$mode & CarbonInterface::TRANSLATE_UNITS ? self::translateWordsByKeys([
|
||||
'year',
|
||||
'month',
|
||||
'week',
|
||||
@@ -411,10 +411,24 @@ trait Localization
|
||||
|
||||
if ($translator instanceof Translator) {
|
||||
$preferredLocale = $translator->getLocale();
|
||||
$fallbackMessages = [];
|
||||
$preferredMessages = $translator->getMessages($preferredLocale);
|
||||
|
||||
foreach (Translator::get($locale)->getMessages()[$locale] ?? [] as $key => $value) {
|
||||
if (
|
||||
preg_match('/^(?:a_)?(.+)_(?:standalone|ago|from_now|before|after|short|min)$/', $key, $match)
|
||||
&& isset($preferredMessages[$match[1]])
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fallbackMessages[$key] = $value;
|
||||
}
|
||||
|
||||
$translator->setMessages($preferredLocale, array_replace_recursive(
|
||||
$translator->getMessages()[$locale] ?? [],
|
||||
Translator::get($locale)->getMessages()[$locale] ?? [],
|
||||
$translator->getMessages($preferredLocale),
|
||||
$fallbackMessages,
|
||||
$preferredMessages,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -573,7 +587,7 @@ trait Localization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableLocales()
|
||||
public static function getAvailableLocales(): array
|
||||
{
|
||||
$translator = static::getLocaleAwareTranslator();
|
||||
|
||||
@@ -588,9 +602,10 @@ trait Localization
|
||||
*
|
||||
* @return Language[]
|
||||
*/
|
||||
public static function getAvailableLocalesInfo()
|
||||
public static function getAvailableLocalesInfo(): array
|
||||
{
|
||||
$languages = [];
|
||||
|
||||
foreach (static::getAvailableLocales() as $id) {
|
||||
$languages[$id] = new Language($id);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ use Generator;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
use ReflectionNamedType;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,7 @@ trait Mixin
|
||||
);
|
||||
|
||||
foreach ($methods as $method) {
|
||||
if ($method->isConstructor() || $method->isDestructor()) {
|
||||
if (self::cannotBeAMixinMethod($method)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,6 +92,36 @@ trait Mixin
|
||||
}
|
||||
}
|
||||
|
||||
private static function cannotBeAMixinMethod(ReflectionMethod $method): bool
|
||||
{
|
||||
if ($method->isConstructor() || $method->isDestructor()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
if ($returnType instanceof ReflectionNamedType) {
|
||||
$returnedTypeName = $returnType->getName();
|
||||
|
||||
if ($returnType->isBuiltin()) {
|
||||
return !\in_array($returnedTypeName, [
|
||||
'callable',
|
||||
'object', // could have __invoke
|
||||
'array', // could be [MyClass::class, 'myMethod']
|
||||
'mixed', // could be one of the above
|
||||
// The other builtin types cannot be callable, so we can skip invoking them
|
||||
], true);
|
||||
}
|
||||
|
||||
// If it returns a non-invokable object, it cannot be a mixin method
|
||||
if (class_exists($returnedTypeName)) {
|
||||
return !is_a($returnedTypeName, Closure::class, true) && !\is_callable([$returnedTypeName, '__invoke']);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function loadMixinTrait(string $trait): void
|
||||
{
|
||||
$context = eval(self::getAnonymousClassCodeForTrait($trait));
|
||||
|
||||
@@ -43,27 +43,22 @@ trait Mutability
|
||||
|
||||
/**
|
||||
* Return a mutable copy of the instance.
|
||||
*
|
||||
* @return Carbon
|
||||
*/
|
||||
public function toMutable()
|
||||
public function toMutable(): Carbon
|
||||
{
|
||||
/** @var Carbon $date */
|
||||
$date = $this->cast(Carbon::class);
|
||||
|
||||
return $date;
|
||||
return $this->cast(Carbon::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a immutable copy of the instance.
|
||||
*
|
||||
* @return CarbonImmutable
|
||||
* Return an immutable copy of the instance.
|
||||
*/
|
||||
public function toImmutable()
|
||||
public function toImmutable(): CarbonImmutable
|
||||
{
|
||||
/** @var CarbonImmutable $date */
|
||||
$date = $this->cast(CarbonImmutable::class);
|
||||
// Immutable objects are fine as is (uncloned)
|
||||
if ($this::class === CarbonImmutable::class) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $date;
|
||||
return $this->cast(CarbonImmutable::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,30 +121,9 @@ trait Serialization
|
||||
return static::instance($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of properties to dump on serialize() called on.
|
||||
*
|
||||
* Only used by PHP < 7.4.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
$properties = $this->getSleepProperties();
|
||||
|
||||
if ($this->localTranslator ?? null) {
|
||||
$properties[] = 'dumpLocale';
|
||||
$this->dumpLocale = $this->locale ?? null;
|
||||
}
|
||||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the values to dump on serialize() called on.
|
||||
*
|
||||
* Only used by PHP >= 7.4.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize(): array
|
||||
@@ -185,41 +164,6 @@ trait Serialization
|
||||
|
||||
/**
|
||||
* Set locale if specified on unserialize() called.
|
||||
*
|
||||
* Only used by PHP < 7.4.
|
||||
*/
|
||||
public function __wakeup(): void
|
||||
{
|
||||
if (parent::class && method_exists(parent::class, '__wakeup')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
try {
|
||||
parent::__wakeup();
|
||||
} catch (Throwable $exception) {
|
||||
try {
|
||||
// FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later.
|
||||
['date' => $date, 'timezone' => $timezone] = $this->dumpDateProperties;
|
||||
parent::__construct($date, $timezone);
|
||||
} catch (Throwable) {
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$this->constructedObjectId = spl_object_hash($this);
|
||||
|
||||
if (isset($this->dumpLocale)) {
|
||||
$this->locale($this->dumpLocale);
|
||||
$this->dumpLocale = null;
|
||||
}
|
||||
|
||||
$this->cleanupDumpProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale if specified on unserialize() called.
|
||||
*
|
||||
* Only used by PHP >= 7.4.
|
||||
*/
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
@@ -297,29 +241,6 @@ trait Serialization
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getSleepProperties(): array
|
||||
{
|
||||
$properties = $this->dumpProperties;
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if (!\extension_loaded('msgpack')) {
|
||||
return $properties;
|
||||
}
|
||||
|
||||
if (isset($this->constructedObjectId)) {
|
||||
$timezone = $this->timezone ?? null;
|
||||
$this->dumpDateProperties = [
|
||||
'date' => $this->format('Y-m-d H:i:s.u'),
|
||||
'timezone' => $this->dumpTimezone($timezone),
|
||||
];
|
||||
|
||||
$properties[] = 'dumpDateProperties';
|
||||
}
|
||||
|
||||
return $properties;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/** @codeCoverageIgnore */
|
||||
private function dumpTimezone(mixed $timezone): mixed
|
||||
{
|
||||
|
||||
@@ -169,7 +169,7 @@ trait Test
|
||||
: $testInstance->format(static::MOCK_DATETIME_FORMAT);
|
||||
}
|
||||
|
||||
private function getMockedTestNowClone($timezone): CarbonInterface|self|null
|
||||
private static function getMockedTestNowClone($timezone): CarbonInterface|self|null
|
||||
{
|
||||
$mock = static::getMockedTestNow($timezone);
|
||||
|
||||
|
||||
@@ -242,9 +242,9 @@ trait Units
|
||||
* @example $date->add(15, 'days')
|
||||
* @example $date->add(CarbonInterval::days(4))
|
||||
*
|
||||
* @param Unit|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
@@ -394,15 +394,18 @@ trait Units
|
||||
* @example $date->sub(15, 'days')
|
||||
* @example $date->sub(CarbonInterval::days(4))
|
||||
*
|
||||
* @param Unit|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function sub($unit, $value = 1, ?bool $overflow = null): static
|
||||
{
|
||||
$unit = Unit::toNameIfUnit($unit);
|
||||
$value = Unit::toNameIfUnit($value);
|
||||
|
||||
if (\is_string($unit) && \func_num_args() === 1) {
|
||||
$unit = CarbonInterval::make($unit, [], true);
|
||||
}
|
||||
@@ -437,9 +440,9 @@ trait Units
|
||||
*
|
||||
* @see sub()
|
||||
*
|
||||
* @param string|DateInterval $unit
|
||||
* @param int|float $value
|
||||
* @param bool|null $overflow
|
||||
* @param Unit|int|string|DateInterval $unit
|
||||
* @param Unit|int|float|string $value
|
||||
* @param bool|null $overflow
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user