Skip to content

Commit 5440e83

Browse files
committed
add symfony console patch to keep width/height simple
1 parent ca8bff5 commit 5440e83

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

composer.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"rector/rector": "^2.0",
2323
"symplify/easy-coding-standard": "^12.4",
2424
"symplify/phpstan-extensions": "^12.0",
25+
"symplify/vendor-patches": "^11.3",
2526
"tomasvotruba/unused-public": "^2.0",
2627
"tracy/tracy": "^2.10"
2728
},
@@ -43,6 +44,7 @@
4344
"sort-packages": true,
4445
"platform-check": false,
4546
"allow-plugins": {
47+
"cweagans/composer-patches": true,
4648
"phpstan/extension-installer": true
4749
}
4850
},
@@ -51,5 +53,12 @@
5153
"fix-cs": "vendor/bin/ecs check --fix --ansi",
5254
"phpstan": "vendor/bin/phpstan analyse --ansi",
5355
"rector": "vendor/bin/rector process --dry-run --ansi"
56+
},
57+
"extra": {
58+
"patches": {
59+
"symfony/console": [
60+
"patches/symfony-console-helper-helper-php.patch"
61+
]
62+
}
5463
}
55-
}
64+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--- /dev/null
2+
+++ ../Helper/Helper.php
3+
@@ -47,9 +47,9 @@
4+
{
5+
$string ??= '';
6+
7+
-// if (preg_match('//u', $string)) {
8+
-// return (new UnicodeString($string))->width(false);
9+
-// }
10+
+ if (preg_match('//u', $string)) {
11+
+ return (new UnicodeString($string))->width(false);
12+
+ }
13+
14+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
15+
return \strlen($string);
16+
@@ -66,9 +66,9 @@
17+
{
18+
$string ??= '';
19+
20+
-// if (preg_match('//u', $string)) {
21+
-// return (new UnicodeString($string))->length();
22+
-// }
23+
+ if (preg_match('//u', $string)) {
24+
+ return (new UnicodeString($string))->length();
25+
+ }
26+
27+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
28+
return \strlen($string);

0 commit comments

Comments
 (0)