laminas-feed icon indicating copy to clipboard operation
laminas-feed copied to clipboard

PHPDoc return types incorrect/outdated

Open Synchro opened this issue 4 years ago • 1 comments

Bug Report

Q A
Version(s) dev-master (currently 2.14.x)

Summary

Return types declared in phpdocs are often incorrect, probably because they are outdated.

For example, in laminas-feed/src/Reader/Entry/Rss.php the getEnclosure() method is declared as:

@return string

when it actually returns a stdClass instance. This is enough to trip up most IDEs and static analysers. I think in this particular case it used to return an array instead of a stdClass, but string is wrong for that too.

There are many examples of this, and it probably applies to other components too. Because it's so widespread, I didn't want to do a PR on spec in case you have some policy on such phpdocs, but I wanted to flag it anyway.

Synchro avatar Nov 20 '20 11:11 Synchro

@Synchro

Return types declared in phpdocs are often incorrect, probably because they are outdated.

You are right. In many cases they are completely wrong. See an example in https://github.com/laminas/laminas-feed/pull/33#issuecomment-750874854

We have to rework the entire component with all classes and their interfaces.

froschdesign avatar Dec 24 '20 13:12 froschdesign