Repository: FriendsOfPHP/PHP-CS-Fixer (php)

Issue:
Custom annotations @type changed into @var
## Bug report

<!--
  Before reporting a bug, make sure PHP CS Fixer is up-to-date.

  Please describe the problem and provide technical details such as:
   * PHP version: php -v
   * PHP CS Fixer version: php-cs-fixer -V
   * the command used to run PHP CS Fixer (run with `-vvv`)
   * the configuration (file) you used
-->

PHP - 7.4.16
PHP CS Fixer - 2.17.0 and above (2.6.10 works )

Running php-cs-fixer without any custom config options changes `@type` into `@var` in custom annotations. Two examples which I've encountered.

```php
<?php

use Symfony\Component\Serializer\Annotation as ApiSerializer;

/**
 * @ApiSerializer\DiscriminatorMap(typeProperty="@type", mapping={
 *     "MyClass" = "App\Entity\MyClass"
 * })
 */
class MyClass
{
    /**
     * @ApiSerializer\SerializedName("@type")
     * @ApiSerializer\Groups({
     *     "my_serialization_group"
     * })
     */
    protected $myAtTypeProperty;
}
```

After running php-cs-fixer it is changed into 
```php
<?php

use Symfony\Component\Serializer\Annotation as ApiSerializer;

/**
 * @ApiSerializer\DiscriminatorMap(typeProperty="@var", mapping={
 *     "MyClass" = "App\Entity\MyClass"
 * })
 */
class MyClass
{
    /**
     * @ApiSerializer\SerializedName("@var")
     * @ApiSerializer\Groups({
     *     "my_serialization_group"
     * })
     */
    protected $myAtTypeProperty;
}
```

`@type` is an ApiPlatform default property representing the short class name of the serialized entity. For some 

Pull request description:
Custom annotations @type changed into @var
Fixes #5544

Patch:
diff --git a/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php b/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php
index 20c07a095..f66804212 100644
--- a/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php
+++ b/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php
@@ -172,9 +172,9 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
 
         if ($this->configuration['fix_annotation']) {
             if ($this->configuration['fix_inline']) {
-                $regex = '/\b(?<=@)(%s)\b/';
+                $regex = '/"[^"]*"(*SKIP)(*FAIL)|\b(?<=@)(%s)\b/';
             } else {
-                $regex = '/(?<!\{@)(?<=@)(%s)(?!\})/';
+                $regex = '/"[^"]*"(*SKIP)(*FAIL)|(?<!\{@)(?<=@)(%s)(?!\})/';
             }
         } else {
             $regex = '/(?<={@)(%s)(?=[ \t}])/';


Test patch:
diff --git a/tests/Fixer/Phpdoc/GeneralPhpdocTagRenameFixerTest.php b/tests/Fixer/Phpdoc/GeneralPhpdocTagRenameFixerTest.php
index 184e3c03b..49578f13f 100644
--- a/tests/Fixer/Phpdoc/GeneralPhpdocTagRenameFixerTest.php
+++ b/tests/Fixer/Phpdoc/GeneralPhpdocTagRenameFixerTest.php
@@ -198,6 +198,44 @@ public function provideFixCases()
                     ],
                 ],
             ],
+            [
+                '<?php
+    /**
+     * @var int $foo
+     * @Annotation("@type")
+     */',
+                '<?php
+    /**
+     * @type int $foo
+     * @Annotation("@type")
+     */',
+                [
+                    'fix_annotation' => true,
+                    'fix_inline' => true,
+                    'replacements' => [
+                        'type' => 'var',
+                    ],
+                ],
+            ],
+            [
+                '<?php
+    /**
+     * @var int $foo
+     * @Annotation("@type")
+     */',
+                '<?php
+    /**
+     * @type int $foo
+     * @Annotation("@type")
+     */',
+                [
+                    'fix_annotation' => true,
+                    'fix_inline' => false,
+                    'replacements' => [
+                        'type' => 'var',
+                    ],
+                ],
+            ],
         ];
     }