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

Problem parsing annotations with doctrine/lexer 2? #478

Closed
herndlm opened this issue Jan 18, 2023 · 1 comment
Closed

Problem parsing annotations with doctrine/lexer 2? #478

herndlm opened this issue Jan 18, 2023 · 1 comment

Comments

@herndlm
Copy link

herndlm commented Jan 18, 2023

I updated doctrine/annotations (1.14.2 => 2.0.0) and suddenly got such errors

Fatal: Uncaught Doctrine\ORM\Mapping\MappingException: Class "Acme\User" is not a valid entity or mapped super class.

Also got some warnings that looked suspicious:

 Warning: Attempt to read property "type" on array in /var/www/html/analytics.icis.com/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php on line 675

After looking around a bit I could confirm that indeed https://github.com/doctrine/annotations/blob/2.0.0/lib/Doctrine/Common/Annotations/DocParser.php#L675 is an array with the key type and most likely that leads to $classAnnotations being empty in Doctrine\ORM\Mapping\Driver\AnnotationDriver::loadMetadataForClass() which throws that exception.

doctrine/lexer is installed in 2.1.0 being required by other doctrine packages like this one

➜ composer why doctrine/lexer
doctrine/annotations 2.0.0  requires doctrine/lexer (^2 || ^3)
doctrine/orm         2.14.0 requires doctrine/lexer (^1.2.3 || ^2)

I'm now wondering - am I doing something wrong here? Most likely this shouldn't have broken just by updating? I'm unfortunately not accustomed with the Doctrine code base well, otherwise I wouldn't have to ask here :)

Looks like #465 is related.

Some more step debugging input in case this helps

image

@herndlm
Copy link
Author

herndlm commented Jan 18, 2023

found the problem 🤦‍♂️

this is some legacy app which has another composer.json where doctrine/lexer v1 was still in use which was autoloaded before...... and the tokens there were of course still arrays instead of objects

sorry for the noise

@herndlm herndlm closed this as completed Jan 18, 2023
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

1 participant