Skip to content

Commit

Permalink
chore:support laravel 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tintnaingwinn committed Apr 27, 2024
1 parent 629d13a commit 23b6a4a
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 125 deletions.
26 changes: 9 additions & 17 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 24 additions & 10 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- 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
23 changes: 17 additions & 6 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
45 changes: 45 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.php_cs
.php_cs.cache
.phpunit.result.cache
.phpunit.cache
composer.phar
composer.lock
coverage
Expand Down
27 changes: 0 additions & 27 deletions CONTRIBUTING.md

This file was deleted.

29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<h1 align="center">Laravel Zawgyi <=> Unicode Package</h1>

[![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).
Expand All @@ -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.
Expand Down Expand Up @@ -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.
18 changes: 7 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Empty file removed phpstan-baseline.neon
Empty file.
9 changes: 1 addition & 8 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
includes:
- phpstan-baseline.neon

parameters:
level: 4
level: 5
paths:
- src
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false
58 changes: 21 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="MyanFont Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="MyanFont Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/MyanFont.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 23b6a4a

Please sign in to comment.