Skip to content

Commit 7fb6abc

Browse files
committed
Updated Rector to commit 78382d288119533208cee5bd2827bdf0222f4064
rectorphp/rector-src@78382d2 Skip hexa chars in EncapsedStringsToSprintfRector (#6719)
1 parent 7af2216 commit 7fb6abc

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,18 @@ public function refactor(Node $node) : ?Node
9797
}
9898
private function shouldSkip(InterpolatedString $interpolatedString) : bool
9999
{
100-
return $interpolatedString->hasAttribute(AttributeKey::DOC_LABEL);
100+
if ($interpolatedString->hasAttribute(AttributeKey::DOC_LABEL)) {
101+
return \true;
102+
}
103+
foreach ($interpolatedString->parts as $part) {
104+
if (!$part instanceof InterpolatedStringPart) {
105+
continue;
106+
}
107+
if ($this->containsASCIIChar($part->value)) {
108+
return \true;
109+
}
110+
}
111+
return \false;
101112
}
102113
private function collectEncapsedStringPart(InterpolatedStringPart $interpolatedStringPart) : void
103114
{
@@ -186,4 +197,8 @@ private function createString(string $value) : String_
186197
$kind = \strpos($value, "'") !== \false ? String_::KIND_DOUBLE_QUOTED : String_::KIND_SINGLE_QUOTED;
187198
return new String_($value, ['kind' => $kind]);
188199
}
200+
private function containsASCIIChar(string $content) : bool
201+
{
202+
return (bool) Strings::match($content, '#[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]#');
203+
}
189204
}

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '95a145f9311826749ea9e72f44c3a3adb2a030f3';
22+
public const PACKAGE_VERSION = '78382d288119533208cee5bd2827bdf0222f4064';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-02-05 15:47:13';
27+
public const RELEASE_DATE = '2025-02-05 15:35:41';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)