Skip to content

Commit

Permalink
Release 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
richardDobron committed Apr 9, 2022
1 parent 3cb3d51 commit 19219ce
Show file tree
Hide file tree
Showing 23 changed files with 65 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.0', '7.1', '7.2', '7.3', '7.4']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']

name: PHP ${{ matrix.php-version }}

Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Expand Up @@ -11,7 +11,7 @@

return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -4,7 +4,7 @@ All notable changes to `fbt` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## v3.0 - 2022-02-18
## v4.0 - 2022-04-09

### Added
- PHP Internationalization Framework for PHP 7.
- Support PHP >= 7.2.
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -25,9 +25,10 @@ $ composer require richarddobron/fbt

## Version Guidance

| Version | Released | Status | Repo | PHP Version |
|---------|------------|--------|------------------|-------------|
| 3.x | 2022-02-18 | Latest | [v3][fbt-3-repo] | >= 7.0 |
| Version | Released | Status | Repo | PHP Version |
|---------|------------|------------|------------------|-------------|
| 3.x | 2022-02-18 | Maintained | [v3][fbt-3-repo] | >= 7.0 |
| 4.x | 2022-04-09 | Latest | [v4][fbt-4-repo] | >= 7.2 |

## Official integrations

Expand Down Expand Up @@ -55,6 +56,7 @@ https://github.com/richardDobron/fbt/tree/main/docs
## License
FBT is MIT licensed, as found in the [LICENSE](LICENSE) file.

[fbt-3-repo]: https://github.com/richarddobron/fbt
[fbt-3-repo]: https://github.com/richarddobron/fbt/tree/3.x
[fbt-4-repo]: https://github.com/richarddobron/fbt
[link-facebook-fbt]: https://github.com/facebook/fbt
[simplehtmldom]: https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/
7 changes: 4 additions & 3 deletions composer.json
Expand Up @@ -3,14 +3,14 @@
"description": "A PHP Internationalization Framework for PHP.",
"keywords": ["php", "i18n", "framework", "internationalization", "translations"],
"require": {
"php": "^7.0",
"php": "^7.2 || ^8.0",
"ext-json": "*",
"ext-dom": "*",
"ext-iconv": "*",
"minicli/minicli": "1.0.4"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^8.5.5 || ^9.3.5"
},
"license": "MIT",
"type": "library",
Expand Down Expand Up @@ -45,5 +45,6 @@
},
"bin": [
"bin/fbt"
]
],
"minimum-stability": "dev"
}
4 changes: 2 additions & 2 deletions src/fbt/Lib/IntlNumberType.php
Expand Up @@ -7,11 +7,11 @@

class IntlNumberType
{
const LOCALE_TO_NUMBER_TYPE = [
public const LOCALE_TO_NUMBER_TYPE = [
"pt_PT" => \fbt\Transform\FbtTransform\Translate\CLDR\IntlCLDRNumberType05::class,
];

const LANG_TO_NUMBER_TYPE = [
public const LANG_TO_NUMBER_TYPE = [
"bm" => \fbt\Transform\FbtTransform\Translate\CLDR\IntlCLDRNumberType01::class,
"bo" => \fbt\Transform\FbtTransform\Translate\CLDR\IntlCLDRNumberType01::class,
"dz" => \fbt\Transform\FbtTransform\Translate\CLDR\IntlCLDRNumberType01::class,
Expand Down
8 changes: 4 additions & 4 deletions src/fbt/Lib/NumberFormatConsts.php
Expand Up @@ -4,9 +4,9 @@

class NumberFormatConsts
{
const DEFAULT_LOCALE = 'en_US';
public const DEFAULT_LOCALE = 'en_US';

const DEFAULT_CONFIG = [
public const DEFAULT_CONFIG = [
"decimalSeparator" => '.',
"numberDelimiter" => ',',
"minDigitsForThousandsSeparator" => 0,
Expand All @@ -17,7 +17,7 @@ class NumberFormatConsts
"numberingSystemData" => null,
];

const CONFIGS = [
public const CONFIGS = [
[
"decimalSeparator" => '.',
"numberDelimiter" => ',',
Expand Down Expand Up @@ -174,7 +174,7 @@ class NumberFormatConsts
],
];

const LOCALE_TO_INDEX = [
public const LOCALE_TO_INDEX = [
"en_US" => 0,
"ca_ES" => 1,
"cs_CZ" => 2,
Expand Down
4 changes: 2 additions & 2 deletions src/fbt/Runtime/FbtRuntimeTypes.php
Expand Up @@ -4,12 +4,12 @@

class FbtRuntimeTypes
{
const PARAM_VARIATION_TYPE = [
public const PARAM_VARIATION_TYPE = [
'number' => 0,
'gender' => 1,
];

const VALID_PRONOUN_USAGES_TYPE = [
public const VALID_PRONOUN_USAGES_TYPE = [
'object' => 0,
'possessive' => 1,
'reflexive' => 2,
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Runtime/FbtTable.php
Expand Up @@ -8,7 +8,7 @@ class FbtTable
* fbt::XXX calls return arguments in the form of
* [<INDEX>, <SUBSTITUTION>] to be processed by fbt::_
*/
const ARG = [
public const ARG = [
"INDEX" => 0,
"SUBSTITUTION" => 1,
];
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Runtime/FbtTranslations.php
Expand Up @@ -7,7 +7,7 @@

class FbtTranslations
{
const DEFAULT_SRC_LOCALE = 'en_US';
public const DEFAULT_SRC_LOCALE = 'en_US';
/** @var array */
public static $translatedFbts = [];

Expand Down
4 changes: 2 additions & 2 deletions src/fbt/Runtime/Gender.php
Expand Up @@ -4,7 +4,7 @@

class Gender
{
const GENDER_CONST = [
public const GENDER_CONST = [
'NOT_A_PERSON' => 0,
'FEMALE_SINGULAR' => 1,
'MALE_SINGULAR' => 2,
Expand All @@ -20,7 +20,7 @@ class Gender
'UNKNOWN_PLURAL' => 11,
];

const DATA = [
public const DATA = [
self::GENDER_CONST['NOT_A_PERSON'] => [
"is_male" => false,
"is_female" => false,
Expand Down
4 changes: 2 additions & 2 deletions src/fbt/Runtime/Shared/IntlPunctuation.php
Expand Up @@ -8,7 +8,7 @@ class IntlPunctuation
* Regular expression snippet containing all the characters that we
* count as sentence-final punctuation.
*/
const PUNCT_CHAR_CLASS = '[.!?' .
public const PUNCT_CHAR_CLASS = '[.!?' .
"\u{3002}" . // Chinese/Japanese period
"\u{FF01}" . // Fullwidth exclamation point
"\u{FF1F}" . // Fullwidth question mark
Expand All @@ -20,7 +20,7 @@ class IntlPunctuation
"\u{FF0E}" . // Fullwidth full stop
']';

const ENDS_IN_PUNCT_REGEXP = '/' .
public const ENDS_IN_PUNCT_REGEXP = '/' .
self::PUNCT_CHAR_CLASS .
"[)\"'" .
// JavaScript doesn't support Unicode character
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Runtime/Shared/IntlVariationResolverImpl.php
Expand Up @@ -8,7 +8,7 @@

class IntlVariationResolverImpl
{
const EXACTLY_ONE = '_1';
public const EXACTLY_ONE = '_1';

/**
* Wrapper around FbtNumberType::getVariation that special cases our EXACTLY_ONE
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Transform/FbtTransform/FbtAutoWrap.php
Expand Up @@ -6,7 +6,7 @@

class FbtAutoWrap
{
const FBT_PARAM_TYPE = [
public const FBT_PARAM_TYPE = [
'IMPLICIT' => 'implicit',
'EXPLICIT' => 'explicit',
'NULL' => 'null',
Expand Down
30 changes: 15 additions & 15 deletions src/fbt/Transform/FbtTransform/FbtConstants.php
Expand Up @@ -12,31 +12,31 @@

class FbtConstants
{
const VALID_PRONOUN_USAGES = [
public const VALID_PRONOUN_USAGES = [
"object" => 0,
"possessive" => 1,
"reflexive" => 2,
"subject" => 3,
];

const PRONOUN_USAGE = [
public const PRONOUN_USAGE = [
"OBJECT" => 0,
"POSSESSIVE" => 1,
"REFLEXIVE" => 2,
"SUBJECT" => 3,
];

const PLURAL_REQUIRED_ATTRIBUTES = [
public const PLURAL_REQUIRED_ATTRIBUTES = [
'count' => true,
];

const SHOW_COUNT = [
public const SHOW_COUNT = [
'yes' => true,
'no' => true,
'ifMany' => true,
];

const PLURAL_OPTIONS = [
public const PLURAL_OPTIONS = [
'value' => true, // optional value to replace token (rather than count)
'showCount' => self::SHOW_COUNT,
'name' => true, // token
Expand All @@ -52,15 +52,15 @@ public static function validPluralOptions(): array
);
}

const VALID_PRONOUN_OPTIONS = [ // js~php diff
public const VALID_PRONOUN_OPTIONS = [ // js~php diff
'human' => ['true' => true, 'false' => true],
'capitalize' => ['true' => true, 'false' => true],
];

/**
* Valid options allowed in the fbt(...) calls.
*/
const VALID_FBT_OPTIONS = [
public const VALID_FBT_OPTIONS = [
'project' => true,
'author' => true,
'preserveWhitespace' => true,
Expand All @@ -70,25 +70,25 @@ public static function validPluralOptions(): array
'reporting' => true, // fbt diff
];

const FBT_BOOLEAN_OPTIONS = [
public const FBT_BOOLEAN_OPTIONS = [
'preserveWhitespace' => true,
'doNotExtract' => true,
];

const FBT_CALL_MUST_HAVE_AT_LEAST_ONE_OF_THESE_ATTRIBUTES = ['desc', 'common'];
public const FBT_CALL_MUST_HAVE_AT_LEAST_ONE_OF_THESE_ATTRIBUTES = ['desc', 'common'];

const FBT_REQUIRED_ATTRIBUTES = [
public const FBT_REQUIRED_ATTRIBUTES = [
'desc' => true,
];

const PRONOUN_REQUIRED_ATTRIBUTES = [
public const PRONOUN_REQUIRED_ATTRIBUTES = [
'type' => true,
'gender' => true,
];

const PLURAL_PARAM_TOKEN = 'number';
public const PLURAL_PARAM_TOKEN = 'number';

const REQUIRED_PARAM_OPTIONS = [
public const REQUIRED_PARAM_OPTIONS = [
'name' => true,
];

Expand All @@ -103,12 +103,12 @@ public static function validParamOptions(): array
);
}

const FBT_TYPE = [
public const FBT_TYPE = [
'TABLE' => 'table',
'TEXT' => 'text',
];

const MODULE_NAME = [
public const MODULE_NAME = [
'FBT' => 'fbt',
// 'REACT_FBT' => 'Fbt',
'FBS' => 'fbs',
Expand Down
4 changes: 2 additions & 2 deletions src/fbt/Transform/FbtTransform/FbtUtils.php
Expand Up @@ -10,7 +10,7 @@

class FbtUtils
{
const FBT_CORE_ATTRIBUTES = [ // js~php diff
public const FBT_CORE_ATTRIBUTES = [ // js~php diff
'implicitDesc' => true,
'implicitFbt' => true,
'paramName' => true,
Expand Down Expand Up @@ -69,7 +69,7 @@ public static function validateNamespacedFbtElement($moduleName, Node $node): st
return $handlerName;
}

const SHORT_BOOL_CANDIDATES = [
public const SHORT_BOOL_CANDIDATES = [
'common' => 'common',
'doNotExtract' => 'doNotExtract',
'number' => 'number',
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Transform/FbtTransform/JSFbtBuilder.php
Expand Up @@ -18,7 +18,7 @@ class JSFbtBuilder
/** @var bool */
private $reactNativeMode;

const PLURAL_KEY_TO_TYPE = [
public const PLURAL_KEY_TO_TYPE = [
'*' => 'many',
IntlVariations::EXACTLY_ONE => 'singular',
];
Expand Down
Expand Up @@ -33,7 +33,7 @@ class FbtFunctionCallProcessor
/* @var array */
protected $runtimeArgs = [];

const VARIATION = [
public const VARIATION = [
'number' => 0,
'gender' => 1,
];
Expand Down
Expand Up @@ -4,7 +4,7 @@

class FBLocaleToLang
{
const LOC_TO_LANG = [
public const LOC_TO_LANG = [
"cx_PH" => "ceb",
"ck_US" => "chr",
"fb_AA" => "en",
Expand Down
Expand Up @@ -6,14 +6,14 @@

class IntlGenderType
{
const MERGED_LOCALES = [
public const MERGED_LOCALES = [
"ht_HT" => 1,
"lv_LV" => 1,
"ar_AR" => 1,
"ks_IN" => 1,
];

const MERGED_LANGS = [
public const MERGED_LANGS = [
"ht" => 1,
"lv" => 1,
"ar" => 1,
Expand Down

0 comments on commit 19219ce

Please sign in to comment.