diff --git a/composer.json b/composer.json index 92b3e58..a582c39 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ "php": "~8.2.0 || ~8.3.0", "ext-mbstring": "*", "ext-tokenizer": "*", - "friendsofphp/php-cs-fixer": "^3.58.1" + "friendsofphp/php-cs-fixer": "^3.59.3" }, "require-dev": { "phpstan/phpstan": "^1.11.4", "phpstan/phpstan-phpunit": "^1.4.0", - "phpunit/phpunit": "^11.2.1" + "phpunit/phpunit": "^11.2.2" }, "autoload": { "psr-4": { diff --git a/lib/Config.php b/lib/Config.php index 8958d51..65f0090 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -68,6 +68,7 @@ final class Config extends PhpCsFixerConfig 'single_line_throw' => false, 'space_after_semicolon' => true, 'static_lambda' => false, + 'string_implicit_backslashes' => ['single_quoted' => 'escape'], 'unary_operator_spaces' => false, 'use_arrow_functions' => false, ]; diff --git a/lib/FinalInternalClassFixer.php b/lib/FinalInternalClassFixer.php index 60f98e8..b8f4a24 100644 --- a/lib/FinalInternalClassFixer.php +++ b/lib/FinalInternalClassFixer.php @@ -83,7 +83,7 @@ private static function isDoctrineEntity(Tokens $tokens, int $classIndex): bool for ($index = $attributeOpenIndex; $index < $classIndex; ++$index) { $content .= $tokens[$index]->getContent(); } - if (1 === \preg_match(\sprintf('/^#\[%s/', self::REGEX), $content)) { + if (1 === \preg_match(\sprintf('/^#\\[%s/', self::REGEX), $content)) { return true; } diff --git a/tests/FunctionReferenceSpaceFixerTest.php b/tests/FunctionReferenceSpaceFixerTest.php index 33ba5e7..299cb9f 100644 --- a/tests/FunctionReferenceSpaceFixerTest.php +++ b/tests/FunctionReferenceSpaceFixerTest.php @@ -26,7 +26,7 @@ public static function provideCases(): array $use = \str_replace(' = array()', '', $use); $use = \str_replace('$array', '$secondArray', $use); - $invariant = \PHP_EOL . \preg_replace('/\s+/', ' ', ' + $invariant = \PHP_EOL . \preg_replace('/\\s+/', ' ', ' $var =& $var; $var =& $var; $var =&$var;