| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function iterate(IterateEvent $event): void |
||
| 41 | { |
||
| 42 | if (!method_exists($event->getIterator(), 'isBufferEmpty')) { |
||
| 43 | throw new \LogicException('You can\'t use DoctrineOptimizeListener with this iterator'); |
||
| 44 | } |
||
| 45 | |||
| 46 | if ($event->getIterator()->isBufferEmpty()) { |
||
| 47 | $this->doctrine->getManager()->getUnitOfWork()->clear(); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.