Skip to content

Commit e00fcfc

Browse files
authored
Merge pull request #7 from worksome/feature/php-8.2
feat: require PHP 8.2 or later
2 parents f01345a + 3745f56 commit e00fcfc

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.1'
19+
php-version: '8.2'
2020
coverage: none
2121

2222
- name: Install composer dependencies

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [8.1]
17+
php: [8.2]
1818
stability: [prefer-stable]
1919

2020
name: P${{ matrix.php }} ${{ matrix.stability }}

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
}
1010
},
1111
"require": {
12-
"php": "^8.1",
12+
"php": "^8.2",
1313
"ext-dom": "*",
14-
"ext-libxml": "*"
14+
"ext-libxml": "*",
15+
"symfony/polyfill-mbstring": "^1.27"
1516
},
1617
"require-dev": {
17-
"pestphp/pest": "^1.22.1",
18+
"pestphp/pest": "^1.22.3",
1819
"pestphp/pest-plugin-parallel": "^1.2",
19-
"worksome/coding-style": "^2.0"
20+
"worksome/coding-style": "^2.3"
2021
},
2122
"scripts": {
2223
"lint": "vendor/bin/ecs --fix --ansi",

src/Html2Text.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use DOMNode;
1111
use DOMProcessingInstruction;
1212
use DOMText;
13+
use Symfony\Polyfill\Mbstring\Mbstring;
1314

1415
class Html2Text
1516
{
@@ -23,8 +24,8 @@ public static function convert(string $html, Config $config = new Config()): str
2324
}
2425

2526
$html = static::fixNewlines($html);
26-
if (mb_detect_encoding($html, "UTF-8", true)) {
27-
$html = mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8");
27+
if (mb_detect_encoding($html, 'UTF-8', true)) {
28+
$html = Mbstring::mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
2829
}
2930

3031
$doc = static::getDocument($html);

0 commit comments

Comments
 (0)