Browse Source

bug #1209 PhpdocParamsFixer - fix corrupting following custom annotation (keradus)

This PR was squashed before being merged into the 1.8 branch (closes #1209).

Discussion
----------

PhpdocParamsFixer - fix corrupting following custom annotation

fixes #1096

Commits
-------

c91639f PhpdocParamsFixer - fix corrupting following custom annotation
Dariusz Ruminski 9 years ago
parent
commit
0b5c80c3b4

+ 1 - 1
Symfony/CS/Fixer/Symfony/PhpdocParamsFixer.php

@@ -36,7 +36,7 @@ class PhpdocParamsFixer extends AbstractFixer
         $desc = '(?:\s+(?P<desc>.*)|\s*)';
 
         $this->regex = '/^ {5}\* @(?:'.$paramTag.'|'.$otherTags.')'.$desc.'$/';
-        $this->regexCommentLine = '/^ {5}\*(?:\s+(?P<desc>.+))(?<!\*\/)$/';
+        $this->regexCommentLine = '/^ {5}\*(?! @)(?:\s+(?P<desc>.+))(?<!\*\/)$/';
     }
 
     /**

+ 22 - 0
Symfony/CS/Tests/Fixer/Symfony/PhpdocParamsFixerTest.php

@@ -249,6 +249,28 @@ EOF;
         $this->makeTest($expected, $input);
     }
 
+    public function testCustomAnnotationsStayUntouched2()
+    {
+        $expected = <<<'EOF'
+<?php
+
+class X
+{
+    /**
+     * @var Collection<Value>|Value[]
+     * @ORM\ManyToMany(
+     *  targetEntity="\Dl\Component\DomainModel\Product\Value\AbstractValue",
+     *  inversedBy="externalAliases"
+     * )
+     */
+    private $values;
+}
+
+EOF;
+
+        $this->makeTest($expected);
+    }
+
     public function testFixWithVar()
     {
         $expected = <<<'EOF'