From 7fb6abc4aea2997366aa28942970cc887f5058dc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 5 Feb 2025 15:38:15 +0000 Subject: [PATCH] Updated Rector to commit 78382d288119533208cee5bd2827bdf0222f4064 https://github.com/rectorphp/rector-src/commit/78382d288119533208cee5bd2827bdf0222f4064 Skip hexa chars in EncapsedStringsToSprintfRector (#6719) --- .../Encapsed/EncapsedStringsToSprintfRector.php | 17 ++++++++++++++++- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index 24dfd56f26b..9fa424ce7a7 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -97,7 +97,18 @@ CODE_SAMPLE } private function shouldSkip(InterpolatedString $interpolatedString) : bool { - return $interpolatedString->hasAttribute(AttributeKey::DOC_LABEL); + if ($interpolatedString->hasAttribute(AttributeKey::DOC_LABEL)) { + return \true; + } + foreach ($interpolatedString->parts as $part) { + if (!$part instanceof InterpolatedStringPart) { + continue; + } + if ($this->containsASCIIChar($part->value)) { + return \true; + } + } + return \false; } private function collectEncapsedStringPart(InterpolatedStringPart $interpolatedStringPart) : void { @@ -186,4 +197,8 @@ CODE_SAMPLE $kind = \strpos($value, "'") !== \false ? String_::KIND_DOUBLE_QUOTED : String_::KIND_SINGLE_QUOTED; return new String_($value, ['kind' => $kind]); } + private function containsASCIIChar(string $content) : bool + { + return (bool) Strings::match($content, '#[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]#'); + } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 012e4287299..33907824cb0 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '95a145f9311826749ea9e72f44c3a3adb2a030f3'; + public const PACKAGE_VERSION = '78382d288119533208cee5bd2827bdf0222f4064'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-02-05 15:47:13'; + public const RELEASE_DATE = '2025-02-05 15:35:41'; /** * @var int */