From 23b6a4a70bfb26289c3155d4447df37cefe3d906 Mon Sep 17 00:00:00 2001 From: Tint Naing Win Date: Sat, 27 Apr 2024 07:12:07 +0700 Subject: [PATCH] chore:support laravel 11.x --- .gitattributes | 26 +++------ .../workflows/fix-php-code-style-issues.yml | 34 +++++++---- .github/workflows/phpstan.yml | 23 ++++++-- .github/workflows/run-tests.yml | 45 ++++++++++++++ .github/workflows/update-changelog.yml | 4 +- .gitignore | 1 + CONTRIBUTING.md | 27 --------- README.md | 29 ++++++++-- composer.json | 18 +++--- phpstan-baseline.neon | 0 phpstan.neon.dist | 9 +-- phpunit.xml.dist | 58 +++++++------------ src/MyanFont.php | 2 +- src/helpers.php | 2 +- 14 files changed, 153 insertions(+), 125 deletions(-) create mode 100644 .github/workflows/run-tests.yml delete mode 100644 CONTRIBUTING.md delete mode 100644 phpstan-baseline.neon diff --git a/.gitattributes b/.gitattributes index 6877ad6..6095c16 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,21 +2,13 @@ # https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html # Ignore all test and documentation with "export-ignore". -/.github export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/phpunit.xml.dist export-ignore -/art export-ignore -/docs export-ignore -/tests export-ignore -/.editorconfig export-ignore -/.php_cs.dist.php export-ignore -/psalm.xml export-ignore -/psalm.xml.dist export-ignore -/testbench.yaml export-ignore -/UPGRADING.md export-ignore -/phpstan.neon.dist export-ignore +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/tests export-ignore +/.editorconfig export-ignore +/CHANGELOG.md export-ignore +/phpstan.neon.dist export-ignore /phpstan-baseline.neon export-ignore -/CHANGELOG.md -/LICENSE.md -/README.md +/phpunit.xml.dist export-ignore +/README.md export-ignore diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index f1e44da..6904aa5 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,21 +1,35 @@ -name: Fix PHP code style issues +name: Check & fix styling on: [push] jobs: php-code-styling: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - ref: ${{ github.head_ref }} + php-version: 8.2 + tools: composer:v2 + coverage: none - - name: Fix PHP code style issues - uses: aglipanci/laravel-pint-action@2.1.0 + - name: Composer & GitHub Authentication + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 + - name: Install composer dependencies + uses: nick-fields/retry@v3 with: - commit_message: Fix styling + timeout_minutes: 3 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress + + - name: Check code style + timeout-minutes: 2 + run: ./vendor/bin/pint --test --preset laravel diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 7ab110b..48f6ef2 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -8,20 +8,31 @@ on: jobs: phpstan: - name: phpstan - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true + + name: Static Analysis + steps: - - uses: actions/checkout@v3 + - name: Check out repository code + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: 8.2 + tools: composer:v2 coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v1 + uses: nick-fields/retry@v2 + with: + timeout_minutes: 3 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress - name: Run PHPStan timeout-minutes: 2 - run: ./vendor/bin/phpstan --error-format=github + run: ./vendor/bin/phpstan analyse --error-format=github diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..2cc1357 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,45 @@ +name: run-tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true + matrix: + php: [ 8.2, 8.3 ] + laravel: [ 11 ] + + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install dependencies + run: | + composer require "laravel/framework:^${{ matrix.laravel }}" --no-update + composer update --prefer-dist --no-interaction --no-progress + + - name: Execute tests + timeout-minutes: 2 + run: vendor/bin/pest diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index b20f3b6..0cdea23 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: main @@ -21,7 +21,7 @@ jobs: release-notes: ${{ github.event.release.body }} - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: branch: main commit_message: Update CHANGELOG diff --git a/.gitignore b/.gitignore index 3e81ddc..f342798 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .php_cs .php_cs.cache .phpunit.result.cache +.phpunit.cache composer.phar composer.lock coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 25315f1..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,27 +0,0 @@ -# Contributing - -Contributions are **welcome** and will be fully **credited**. - -We accept contributions via Pull Requests on [Github](https://github.com/tintnaingwinn/MyanFont). - -## Pull Requests - -- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). - -- **Add tests!** - Your patch won't be accepted if it doesn't have tests. - -- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. - -- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. - -- **Create feature branches** - Don't ask us to pull from your master branch. - -- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. - -- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. - -## Running Tests - -$ composer test - -**Happy coding**! diff --git a/README.md b/README.md index da76fcc..c118374 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,32 @@

Laravel Zawgyi <=> Unicode Package

[![Latest Version on Packagist](https://img.shields.io/packagist/v/tintnaingwin/myanfont.svg?style=flat-square)](https://packagist.org/packages/tintnaingwin/myanfont) -[![Laravel 9.x](https://img.shields.io/badge/Laravel-9.x-red.svg?style=flat-square)](http://laravel.com/docs/9.x) -[![Laravel 10.x](https://img.shields.io/badge/Laravel-10.x-red.svg?style=flat-square)](http://laravel.com/docs/10.x) +[![Laravel 11.x](https://img.shields.io/badge/Laravel-11.x-red.svg?style=flat-square)](http://laravel.com/docs/11.x) [![Total Downloads](https://img.shields.io/packagist/dt/tintnaingwin/myanfont.svg?style=flat-square)](https://packagist.org/packages/tintnaingwin/myanfont) [![License](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://packagist.org/packages/tintnaingwin/myanfont) ## Requirements +#### version-4.* +- [PHP ^8.2|^8.3](http://php.net/) +- [Laravel ^11.x](https://github.com/laravel/framework) + #### version-3.* - [PHP ^8.0|^8.1|^8.2](http://php.net/) - [Laravel 8.x|9.x|^10.x](https://github.com/laravel/framework) #### version-2.* +Unsupported since 27-4-2024 - [PHP ^7.1.3|^8.0](http://php.net/) - [Laravel 5.6|5.7|5.8|6.x|7.x|8.x](https://github.com/laravel/framework) #### version-1.* +Unsupported since 27-4-2024 - [PHP ^7.0](http://php.net/) - [Laravel 5.5|5.6|5.7|5.8](https://github.com/laravel/framework) #### version-0.* +Unsupported since 27-4-2024 - [PHP ^5.5.6](http://php.net/) Read the extensive documentation [on version 0.x](https://github.com/tintnaingwinn/MyanFont/tree/v0.x) and [on version 1.x](https://github.com/tintnaingwinn/MyanFont/tree/v1). @@ -29,7 +35,7 @@ Read the extensive documentation [on version 0.x](https://github.com/tintnaingwi You can install this package via composer using this command: ```bash -composer require tintnaingwin/myanfont:"~3.0" +composer require tintnaingwin/myanfont:"~4.0" ``` The package will automatically register itself. @@ -85,9 +91,22 @@ You can run the tests with: composer test ``` +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Contributing + +Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. + +## Security Vulnerabilities + +Please review [our security policy](../../security/policy) on how to report security vulnerabilities. + ## Credits + - [Rabbit Converter](https://github.com/Rabbit-Converter/Rabbit-PHP) -### License +## License -The MIT License (MIT). Please see [License File](https://github.com/tintnaingwinn/MyanFont/blob/main/LICENSE.md) for more information. +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/composer.json b/composer.json index ee3269a..741e371 100644 --- a/composer.json +++ b/composer.json @@ -17,21 +17,17 @@ } ], "require": { - "php": "^8.0|^8.1|^8.2", + "php": "^8.2", "ext-json": "*", - "illuminate/contracts": "^8.0|^9.0|^10.0", - "illuminate/support": "^8.0|^9.0|^10.0" + "illuminate/contracts": "^11.0", + "illuminate/support": "^11.0" }, "require-dev": { "laravel/pint": "^1.6", - "nunomaduro/collision": "^5.10|^6.1", - "nunomaduro/larastan": "^1.0|^2.0", - "orchestra/testbench": "^6.23|^7.0|^8.0", - "pestphp/pest": "^1.21|^2.0", - "pestphp/pest-plugin-laravel": "^1.1|^2.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0" + "phpstan/phpstan": "^1.10", + "orchestra/testbench": "^8.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0" }, "autoload": { "psr-4": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index e69de29..0000000 diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 19a28c4..91e6453 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,11 +1,4 @@ -includes: - - phpstan-baseline.neon - parameters: - level: 4 + level: 5 paths: - src - tmpDir: build/phpstan - checkOctaneCompatibility: true - checkModelProperties: true - checkMissingIterableValueType: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 47ed072..47c0b43 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,39 +1,23 @@ - - - - tests - - - - - src/ - - - - - - - - - - + + + + tests + + + + + + + + + + + + + + + src/ + + diff --git a/src/MyanFont.php b/src/MyanFont.php index ec63a15..fe0a9ae 100644 --- a/src/MyanFont.php +++ b/src/MyanFont.php @@ -49,7 +49,7 @@ public function isZgOrUni(?string $text): string return config('myanfont.fallback_font', self::UNICODE); } - $zgPattern = "/[\x{105a}\x{1060}-\x{1097}]|[\x{1033}\x{1034}]|\x{1031}\x{108f}|\x{1031}[\x{103b}-\x{103e}]|[\x{102b}-\x{1030}\x{1032}]\x{1031}| \x{1031}| \x{103b}|^\x{1031}|^\x{103b}|\x{1038}\x{103b}|\x{1038}\x{1031}|[\x{102d}\x{102e}\x{1032}]\x{103b}|\x{1039}[^\x{1000}-\x{1021}]|\x{1039}$|\x{1004}\x{1039}[\x{1001}-\x{102a}\x{103f}\x{104e}]|\x{1039}[^u1000}-\x{102a}\x{103f}\x{104e}]|\x{103c}\x{103b}|\x{103d}\x{103b}|\x{103e}\x{103b}|\x{103d}\x{103c}|\x{103e}\x{103c}|\x{103e}\x{103d}|\x{103b}\x{103c}|[\x{102f}\x{1030}\x{102b}\x{102c}][\x{102d}\x{102e}\x{1032}]|[\x{102b}\x{102c}][\x{102f}\x{102c}]|[\x{1040}-\x{1049}][\x{102b}-\x{103e}\x{102b}-\x{1030}\x{1032}\x{1036}\x{1037}\x{1038}\x{103a}]|^[\x{1040}\x{1047}][^\x{1040}-\x{1049}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{101a}\x{101b}\x{101d}\x{101f}\x{1022}-\x{103f}]|\x{103a}\x{103e}|\x{1036}\x{102b}]|\x{102d}[\x{102e}\x{1032}]|\x{102e}[\x{102d}\x{1032}]|\x{1032}[\x{102d}\x{102e}]|\x{102f}\x{1030}|\x{1030}\x{102f}|\x{102b}\x{102c}|\x{102c}\x{102b}|[\x{1090}-\x{1099}][\x{102b}-\x{1030}\x{1032}\x{1037}\x{103a}-\x{103e}]|[\x{1000}-\x{10f4}][\x{1090}-\x{1099}][\x{1000}-\x{104f}]|^[\x{1090}-\x{1099}][\x{1000}-\x{102a}\x{103f}\x{104e}\x{104a}\x{104b}]|[\x{1000}-\x{104f}][\x{1090}-\x{1099}]$|[\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}][\x{102b}-\x{103e}]|[\x{1000}-\x{102a}]\x{103a}[\x{102d}\x{102e}\x{1032}]|[\x{102b}-\x{1030}\x{1032}\x{1036}-\x{1038}\x{103a}]\x{1031}|[\x{1087}-\x{108d}][\x{106e}-\x{1070}\x{1072}-\x{1074}]|^[\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}]|[\x{0020}\x{104a}\x{104b}][\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}]|[\x{1036}\x{103a}][\x{102d}-\x{1030}\x{1032}]|[\x{1025}\x{100a}]\x{1039}|[\x{108e}-\x{108f}][\x{1050}-\x{108d}]|\x{102d}-\x{1030}\x{1032}\x{1036}-\x{1037}]\x{1039}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1037}\x{1039}|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{102c}\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]|[\x{102b}-\x{1030}\x{1032}][\x{103b}-\x{103e}]|\x{1032}[\x{103b}-\x{103e}]|\x{101b}\x{103c}|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}][\x{102b}\x{1032}\x{103d}]|[\x{1000}\x{1005}\x{100f}\x{1010}\x{1012}\x{1014}\x{1015}\x{1019}\x{101a}]\x{1039}\x{1021}|[\x{1000}\x{1010}]\x{1039}\x{1019}|\x{1004}\x{1039}\x{1000}|\x{1015}\x{1039}[\x{101a}\x{101e}]|\x{1000}\x{1039}\x{1001}\x{1036}|\x{1039}\x{1011}\x{1032}|\x{1037}\x{1032}|\x{1036}\x{103b}|\x{102f}\x{102f}/u"; + $zgPattern = "/[\x{105a}\x{1060}-\x{1097}]|[\x{1033}\x{1034}]|\x{1031}\x{108f}|\x{1031}[\x{103b}-\x{103e}]|[\x{102b}-\x{1030}\x{1032}]\x{1031}| \x{1031}| \x{103b}|^\x{1031}|^\x{103b}|\x{1038}\x{103b}|\x{1038}\x{1031}|[\x{102d}\x{102e}\x{1032}]\x{103b}|\x{1039}[^\x{1000}-\x{1021}]|\x{1039}$|\x{1004}\x{1039}[\x{1001}-\x{102a}\x{103f}\x{104e}]|\x{1039}[^u1000}-\x{102a}\x{103f}\x{104e}]|\x{103c}\x{103b}|\x{103d}\x{103b}|\x{103e}\x{103b}|\x{103d}\x{103c}|\x{103e}\x{103c}|\x{103e}\x{103d}|\x{103b}\x{103c}|[\x{102f}\x{1030}\x{102b}\x{102c}][\x{102d}\x{102e}\x{1032}]|[\x{102b}\x{102c}][\x{102f}\x{102c}]|[\x{1040}-\x{1049}][\x{102b}-\x{103e}\x{102b}-\x{1030}\x{1032}\x{1036}\x{1037}\x{1038}\x{103a}]|^[\x{1040}\x{1047}][^\x{1040}-\x{1049}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{101a}\x{101b}\x{101d}\x{101f}\x{1022}-\x{103f}]|\x{103a}\x{103e}|\x{1036}\x{102b}]|\x{102d}[\x{102e}\x{1032}]|\x{102e}[\x{102d}\x{1032}]|\x{1032}[\x{102d}\x{102e}]|\x{102f}\x{1030}|\x{1030}\x{102f}|\x{102b}\x{102c}|\x{102c}\x{102b}|[\x{1090}-\x{1099}][\x{102b}-\x{1030}\x{1032}\x{1037}\x{103a}-\x{103e}]|[\x{1000}-\x{10f4}][\x{1090}-\x{1099}][\x{1000}-\x{104f}]|^[\x{1090}-\x{1099}][\x{1000}-\x{102a}\x{103f}\x{104e}\x{104a}\x{104b}]|[\x{1000}-\x{104f}][\x{1090}-\x{1099}]$|[\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}][\x{102b}-\x{103e}]|[\x{1000}-\x{102a}]\x{103a}[\x{102d}\x{102e}\x{1032}]|[\x{102b}-\x{1030}\x{1032}\x{1036}-\x{1038}\x{103a}]\x{1031}|[\x{1087}-\x{108d}][\x{106e}-\x{1070}\x{1072}-\x{1074}]|^[\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}]|[\x{0020}\x{104a}\x{104b}][\x{105e}-\x{1060}\x{1062}-\x{1064}\x{1067}-\x{106d}\x{1071}-\x{1074}\x{1082}-\x{108d}\x{108f}\x{109a}-\x{109d}]|[\x{1036}\x{103a}][\x{102d}-\x{1030}\x{1032}]|\x{100a}\x{1039}|[\x{108e}-\x{108f}][\x{1050}-\x{108d}]|\x{102d}-\x{1030}\x{1032}\x{1036}-\x{1037}]\x{1039}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1037}\x{1039}|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{102c}\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]|[\x{102b}-\x{1030}\x{1032}][\x{103b}-\x{103e}]|\x{1032}[\x{103b}-\x{103e}]|\x{101b}\x{103c}|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}]|[\x{1000}-\x{102a}\x{103f}\x{104e}]\x{1039}[\x{1000}-\x{102a}\x{103f}\x{104e}][\x{102b}\x{1032}\x{103d}]|[\x{1000}\x{1005}\x{100f}\x{1010}\x{1012}\x{1014}\x{1015}\x{1019}\x{101a}]\x{1039}\x{1021}|[\x{1000}\x{1010}]\x{1039}\x{1019}|\x{1004}\x{1039}\x{1000}|\x{1015}\x{1039}[\x{101a}\x{101e}]|\x{1000}\x{1039}\x{1001}\x{1036}|\x{1039}\x{1011}\x{1032}|\x{1037}\x{1032}|\x{1036}\x{103b}|\x{102f}\x{102f}/u"; return preg_match($zgPattern, $text) ? self::ZAWGYI : self::UNICODE; } diff --git a/src/helpers.php b/src/helpers.php index febc51f..0671722 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -48,6 +48,6 @@ function isUnicode(string $text = ''): bool */ function isZawgyi(string $text = ''): bool { - return MyanFont::isZawGyi($text); + return MyanFont::isZawgyi($text); } }