doctrine / doctrine/annotations
Skipped annotation when line above contains double quote (v1.8.0)
- Dominant language
- PHP
- Stars
- 6.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
The second `Regex` annotation is ignored by annotation reader, if the line above contains a double quote `"`. See the very simplified example:
*class*
```php
namespace AppBundle\Component;
use Symfony\Component\Validator\Constraints as Assert;
class Foo
{
/**
* @Assert\Regex(pattern="~[a-zA-Z]~")
* "
* @Assert\Regex(pattern="~[<>\\'""*]+~", match=false)
*/
private $foo;
}
```
*reader*
```php
$reflectionClass = new \ReflectionClass(\AppBundle\Component\Foo::class);
$property = $reflectionClass->getProperty('foo');
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$annotations = $reader->getPropertyAnnotations($property);
dump($annotations);
```
*expected result*
```
array:2 [▼
0 => Regex^ {#1592 ▼
+message: "This value is not valid."
+pattern: "~[a-zA-Z]~"
+htmlPattern: null
+match: true
+payload: null
}
1 => Regex^ {#1533 ▼
+message: "This value is not valid."
+pattern: "~[<>\\'"*]+~"
+htmlPattern: null
+match: false
+payload: null
}
]
```
*actual result*
```
array:1 [▼
0 => Regex^ {#1592 ▼
+message: "This value is not valid."
+pattern: "~[a-zA-Z]~"
+htmlPattern: null
+match: true
+payload: null
}
]
```
Contributor guide
Assessment
This issue has not been assessed yet.