phpstan
phpstan copied to clipboard
Single quote in specific string text in phpdoc is not parsed correctly
Bug report
Please see the demo, the phpdoc should allow " (double quote char) and ' (single quote char) values.
I tried '''' phpdoc type (escape using two double quotes), but it does not work either.
I belive this is a bug. The phpdoc type should parse single quoted string using standard php single quoted string grammar.
Code snippet that reproduces the problem
https://phpstan.org/r/ae89f38f-7968-42f2-8b48-c111183e5778
Expected output
no error
See phpstan/phpdoc-parser#142
@mvorisek After the latest push in 1.9.x, PHPStan now reports different result with your code snippet:
@@ @@
-10: Static property HelloWorld::$u ('"'|'\\') does not accept '\''.
+10: Static property HelloWorld::$u ('"'|'\\\'') does not accept '\''.
Full report
| Line | Error |
|---|---|
| 10 | `Static property HelloWorld::$u ('"' |
Works with bleedingEdge.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.