1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Allow empty-string in first position of an type (#5814)

This commit is contained in:
orklah 2021-05-22 18:36:02 +02:00 committed by GitHub
parent 6a61298074
commit c69cf9a849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -279,7 +279,7 @@ class CommentAnalyzer
$last_char = $i > 0 ? $return_block[$i - 1] : null; $last_char = $i > 0 ? $return_block[$i - 1] : null;
if ($quote_char) { if ($quote_char) {
if ($char === $quote_char && $i > 1 && !$escaped) { if ($char === $quote_char && !$escaped) {
$quote_char = null; $quote_char = null;
$type .= $char; $type .= $char;

View File

@ -1201,6 +1201,15 @@ class AnnotationTest extends TestCase
takesFlags(FileFlag::MODIFIED | FileFlag::NEW);' takesFlags(FileFlag::MODIFIED | FileFlag::NEW);'
], ],
'emptyStringFirst' => [
'<?php
/**
* @param \'\'|\'a\'|\'b\' $v
*/
function testBad(string $v): void {
echo $v;
}'
],
]; ];
} }