phpdoc-parser icon indicating copy to clipboard operation
phpdoc-parser copied to clipboard

Cannot use backslash as a literal string in conditional return type

Open mad-briller opened this issue 1 year ago • 1 comments

i can't get phpstan to recognise \\ in a literal string: https://phpstan.org/r/41f1530f-eaee-4e7d-8bfc-e7ccc7cfc7a7

using any other sting there makes it work just fine: https://phpstan.org/r/a884b37d-682b-45a4-b891-1725ffd1c428

Originally posted by @mad-briller in https://github.com/phpstan/phpstan/issues/7483#issuecomment-1200168302

mad-briller avatar Aug 03 '22 18:08 mad-briller

This is actually a feature request for phpstan/phpdoc-parser - it only trims away the surrounding quotes but doesn't un-escape the string otherwise, so '\\' actually becomes '\\\\'.

Changing this is technically a BC break though :/

rvanvelzen avatar Aug 04 '22 06:08 rvanvelzen

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]