phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

Single quote in specific string text in phpdoc is not parsed correctly

Open mvorisek opened this issue 3 years ago • 1 comments
trafficstars

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

mvorisek avatar Aug 14 '22 13:08 mvorisek

See phpstan/phpdoc-parser#142

rvanvelzen avatar Aug 14 '22 13:08 rvanvelzen

@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 ('"'

phpstan-bot avatar Oct 20 '22 08:10 phpstan-bot

Works with bleedingEdge.

ondrejmirtes avatar Oct 20 '22 08:10 ondrejmirtes

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.

github-actions[bot] avatar Nov 21 '22 00:11 github-actions[bot]