Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse if there's a whitespace after trailing comma in an array shape. #10100

Closed
hamsbrar opened this issue Aug 10, 2023 · 2 comments
Closed

Comments

@hamsbrar
Copy link

https://psalm.dev/r/012810a311

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/012810a311
<?php

/**
 * @return array{
 *      a: int, 
 * }
 */
function f1() {
  return ['a' => 1 ];
}

// note: in above example, there's a whitespace after 'a:string,'
// removing which makes parser happy:

/**
 * @return array{
 *      a: int,
 * }
 */
function f2() {
  return ['a' => 1 ];
}
Psalm output (using commit 73ebe22):

ERROR: InvalidDocblock - 8:1 - Cannot parse array type in docblock for f1

INFO: MissingReturnType - 8:10 - Method f1 does not have a return type, expecting array{a: 1}

@weirdan
Copy link
Collaborator

weirdan commented Feb 10, 2024

Fixed in #10326

@weirdan weirdan closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants