doctrine / doctrine/annotations
PHP 8 Annotations bug?
- Dominant language
- PHP
- Stars
- 6.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
My stack:
php: 8.0.0
symfony: 5.2
doctrine/orm: 2.8.1
doctrine/doctrine-bundle: 2.2.2
I have the next entitity:

I try to request a user by his login through the repository
```php
return new Response(
$this->userRepository->findOneBy(['login' => 'someLogin'])->getLogin()
);
```
and catch the next error:

This is due to the fact that the Doctrine annotation parser tries to go through all the properties of the annotation @ORM\Id (see the first screenshot).
And since they don't exist, the foreach loop passes null and I catch this error.
To confirm my words, I attach screenshots from the xdebug:
Doctrine\Common\Annotations\CachedReader::getPropertyAnnotation()

Doctrine\Common\Annotations\CachedReader::getPropertyAnnotations()

Contributor guide
Assessment
This issue has not been assessed yet.