Skip to content

Commit

Permalink
Upgrade to PHP 8.1 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fre5h committed Dec 3, 2021
1 parent ee77716 commit f3922c3
Show file tree
Hide file tree
Showing 10 changed files with 293 additions and 295 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
ini-values: memory_limit=-1
coverage: none
tools: composer:v2

- name: 'Install Dependencies'
run: composer install --prefer-dist --no-progress --no-interaction

Expand All @@ -41,7 +49,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
Expand All @@ -66,7 +74,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
Expand All @@ -86,10 +94,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2
Expand Down Expand Up @@ -122,7 +127,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
ini-values: memory_limit=-1
coverage: pcov
tools: composer:v2
Expand Down
22 changes: 12 additions & 10 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
preset: recommended

version: 8.1

enabled:
- combine_consecutive_unsets
- linebreak_after_opening_tag
- ordered_class_elements
- unalign_double_arrow
- combine_consecutive_unsets
- linebreak_after_opening_tag
- ordered_class_elements
- unalign_double_arrow

disabled:
- align_double_arrow
- align_double_arrow

finder:
exclude:
- "tests"
- "*Test.php"
name:
- "*.php"
exclude:
- "tests"
- "*Test.php"
name:
- "*.php"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ PHP library for transliteration. 🇺🇦 🇬🇧 🇷🇺 🔡 🐘

## Requirements 🧐

* PHP 7.2 *and later*
* PHP >= 8.1

## Installation 🌱

```composer req fresh/transliteration='~2.1'```
```composer req fresh/transliteration='~3.0'```

## Available transliteration methods 🎁

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"issues": "https://github.com/fre5h/transliteration/issues"
},
"require": {
"php": ">=7.2"
"php": ">=8.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "~8.5",
"slam/phpstan-extensions": "^5.0.2",
"squizlabs/php_codesniffer": "~3.5",
"thecodingmachine/phpstan-strict-rules": "^0.12"
"friendsofphp/php-cs-fixer": "^3.3",
"phpstan/phpstan": "^1.2.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpunit/phpunit": "^9.5",
"slam/phpstan-extensions": "^6.0",
"squizlabs/php_codesniffer": "^3.6",
"thecodingmachine/phpstan-strict-rules": "^1.0.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 3 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ includes:
- 'vendor/phpstan/phpstan-phpunit/rules.neon'
- 'vendor/slam/phpstan-extensions/conf/slam-rules.neon'
parameters:
level: 8
excludes_analyse:
level: 9
excludePaths:
- '%rootDir%/../../../tests/*'
- '%rootDir%/../../../vendor/*'
fileExtensions:
- 'php'
checkMissingIterableValueType: false
12 changes: 6 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.5/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
>
Expand All @@ -11,9 +11,9 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion src/RussianToEnglish.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class RussianToEnglish implements TransliteratorInterface
{
/** @const string[] */
/** @const array<string, string> */
private const RUSSIAN_TO_ENGLISH_RULES = [
'а' => 'a',
'б' => 'b',
Expand Down
2 changes: 1 addition & 1 deletion src/UkrainianToEnglish.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class UkrainianToEnglish implements TransliteratorInterface
{
/** @const string[] */
/** @const array<string, string> */
private const UKRAINIAN_TO_ENGLISH_RULES = [
'А' => 'A',
'Б' => 'B',
Expand Down
137 changes: 67 additions & 70 deletions tests/RussianToEnglishTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
*/
class RussianToEnglishTest extends TestCase
{
/** @var Transliterator */
protected $transliterator;
protected Transliterator $transliterator;

protected function setUp(): void
{
Expand All @@ -40,74 +39,72 @@ public function testTransliterationFromRussianToEnglish(string $russianText, str
self::assertEquals($transliteratedText, $this->transliterator->ruToEn($russianText));
}

public function alphabetProvider(): array
public function alphabetProvider(): iterable
{
return [
['а', 'a'],
['б', 'b'],
['в', 'v'],
['г', 'g'],
['д', 'd'],
['е', 'e'],
['ё', 'e'],
['ж', 'zh'],
['з', 'z'],
['и', 'i'],
['й', 'y'],
['к', 'k'],
['л', 'l'],
['м', 'm'],
['н', 'n'],
['о', 'o'],
['п', 'p'],
['р', 'r'],
['с', 's'],
['т', 't'],
['у', 'u'],
['ф', 'f'],
['х', 'h'],
['ц', 'ts'],
['ч', 'ch'],
['ш', 'sh'],
['щ', 'sht'],
['ь', ''],
['ы', 'y'],
['ъ', ''],
['э', 'e'],
['ю', 'yu'],
['я', 'ya'],
['А', 'A'],
['Б', 'B'],
['В', 'V'],
['Г', 'G'],
['Д', 'D'],
['Е', 'E'],
['Ж', 'Zh'],
['З', 'Z'],
['И', 'I'],
['Й', 'Y'],
['К', 'K'],
['Л', 'L'],
['М', 'M'],
['Н', 'N'],
['О', 'O'],
['П', 'P'],
['Р', 'R'],
['С', 'S'],
['Т', 'T'],
['У', 'U'],
['Ф', 'F'],
['Х', 'H'],
['Ц', 'Ts'],
['Ч', 'Ch'],
['Ш', 'Sh'],
['Щ', 'Sht'],
['Ь', ''],
['Ы', 'Y'],
['Ъ', ''],
['Э', 'E'],
['Ю', 'Yu'],
['Я', 'Ya'],
];
yield ['А', 'A'];
yield ['Б', 'B'];
yield ['В', 'V'];
yield ['Г', 'G'];
yield ['Д', 'D'];
yield ['Е', 'E'];
yield ['Ж', 'Zh'];
yield ['З', 'Z'];
yield ['И', 'I'];
yield ['Й', 'Y'];
yield ['К', 'K'];
yield ['Л', 'L'];
yield ['М', 'M'];
yield ['Н', 'N'];
yield ['О', 'O'];
yield ['П', 'P'];
yield ['Р', 'R'];
yield ['С', 'S'];
yield ['Т', 'T'];
yield ['У', 'U'];
yield ['Ф', 'F'];
yield ['Х', 'H'];
yield ['Ц', 'Ts'];
yield ['Ч', 'Ch'];
yield ['Ш', 'Sh'];
yield ['Щ', 'Sht'];
yield ['Ь', ''];
yield ['Ы', 'Y'];
yield ['Ъ', ''];
yield ['Э', 'E'];
yield ['Ю', 'Yu'];
yield ['Я', 'Ya'];
yield ['а', 'a'];
yield ['б', 'b'];
yield ['в', 'v'];
yield ['г', 'g'];
yield ['д', 'd'];
yield ['е', 'e'];
yield ['ё', 'e'];
yield ['ж', 'zh'];
yield ['з', 'z'];
yield ['и', 'i'];
yield ['й', 'y'];
yield ['к', 'k'];
yield ['л', 'l'];
yield ['м', 'm'];
yield ['н', 'n'];
yield ['о', 'o'];
yield ['п', 'p'];
yield ['р', 'r'];
yield ['с', 's'];
yield ['т', 't'];
yield ['у', 'u'];
yield ['ф', 'f'];
yield ['х', 'h'];
yield ['ц', 'ts'];
yield ['ч', 'ch'];
yield ['ш', 'sh'];
yield ['щ', 'sht'];
yield ['ь', ''];
yield ['ы', 'y'];
yield ['ъ', ''];
yield ['э', 'e'];
yield ['ю', 'yu'];
yield ['я', 'ya'];
}
}
Loading

0 comments on commit f3922c3

Please sign in to comment.