Issue Bug Closed

#94305AbstractDomainObject::getUid() has wrong PHPDOC

Armin Vieweg 06/10/21, 18:36 updated 09/07/21, 07:33

Description

The current master, but also earlier TYPO3 versions, have an incorrect PHPDOC for the getUid() method of each persisted Extbase entity.

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php#L72

This is the annotation:

@return int the uid or NULL if none set yet.

For code tools (like Rector), this looks like the method will return integer always. But it may also returns null (for new entities). This may lead to unwanted refactorings.
Espeacially in older TYPO3 version, which have no (correct) return type hinting set. There the PHPDOC is the only truth.

Still, PHPDOC and return type hinting does not match.

Reviews 2