Skip to content

support for array-shapes? #263

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

Closed
voku opened this issue Oct 29, 2020 · 3 comments
Closed

support for array-shapes? #263

voku opened this issue Oct 29, 2020 · 3 comments
Assignees

Comments

@voku
Copy link
Contributor

voku commented Oct 29, 2020

I tried to collect data structures of php-files or -strings: https://github.com/voku/Simple-PHP-Code-Parser ... but I have a problem with the "ReflectionDocBlock" package, I do something like:

 $parsedParamTags = $phpDoc->getTagsByName('param');
$parsedReturnTag = $phpDoc->getTagsByName('return');

But then I get InvalidTag when I use modern PHPDocs from PHPStan (https://phpstan.org/writing-php-code/phpdoc-types) or psalm (https://psalm.dev/docs/annotating_code/type_syntax/array_types/#object-like-arrays). PS: The syntax is also supported by PhpStorm (https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-2/#psalm_and_phpdoc_annotations).

Do you plan to support the new syntax for e.g. arrays-shapes?

e.g.:

/** 
 * @return array{stdClass: \stdClass, numbers: int|float} $lall
 */


"InvalidArgumentException | "\array{stdClass: \stdClass" is not a valid Fqsen.

voku added a commit to voku/Simple-PHP-Code-Parser that referenced this issue Oct 30, 2020
@kkmuffme
Copy link

This is definitely needed, since it's getting much more common

@jaapio jaapio self-assigned this Oct 28, 2022
@jaapio
Copy link
Member

jaapio commented Oct 28, 2022

will be part of #343

@jaapio
Copy link
Member

jaapio commented Nov 18, 2022

Fixed in #343

@jaapio jaapio closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants