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

Undefined constant ArrayShapeNode::KIND_NON_EMPTY_ARRAY #268

Closed
distantnative opened this issue Feb 26, 2025 · 3 comments
Closed

Undefined constant ArrayShapeNode::KIND_NON_EMPTY_ARRAY #268

distantnative opened this issue Feb 26, 2025 · 3 comments

Comments

@distantnative
Copy link

distantnative commented Feb 26, 2025

I'm running into the following error:

Undefined constant PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode::KIND_NON_EMPTY_ARRAY

on phpstan/phpdoc-parser/src/Parser/TypeParser.php:204.

Reproducible for me with the example code:

$config          = new ParserConfig(usedAttributes: []);
$lexer           = new Lexer();
$constExprParser = new ConstExprParser();
$typeParser     = new TypeParser($config, $constExprParser);
$phpDocParser   = new PhpDocParser($config, $typeParser, $constExprParser);
$tokens          = new TokenIterator($lexer->tokenize('/** @param Lorem $a */'));
return $phpDocParser->parse($tokens);
@ondrejmirtes
Copy link
Member

This bug is not present in this library. Can you please try this in an empty project?

My suspicion is some kind of mix-up of versions from phpstan.phar or something like that. Please post your composer.json.

@distantnative
Copy link
Author

Thank you, indeed. It seems like composer got mixed up when moving from phpdocumentor/reflection-docblock to this library with a wrong version. Resetting composer and freshly installing this library resolved it. Thanks again!

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants