This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
PHPDoc for EntryInterface::getAuthor is incorrect #83
Labels
Comments
It's an array: zend-feed/test/Reader/Entry/AtomTest.php Lines 213 to 238 in 54dffde
zend-feed/test/Reader/Entry/RssTest.php Lines 981 to 988 in 54dffde
|
weierophinney
added a commit
that referenced
this issue
Mar 5, 2019
Fixes #83 - PHPDoc for EntryInterface::getAuthor is incorrect
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
My IDE flagged a type mismatch on the results of a call to
Entry::getAuthor()
when there shouldn't be one.Code to reproduce the issue
This line declares the interface for
getAuthor
as returningstring|null
, and the implementation in the Rss class declares it returns a string (and doesn't mentionnull
), but it really returns an associative array containing a singlename
element, because it returns a single element of the return value ofgetAuthors()
, as seen in this implementation in theRss
class.The Atom class does something similar, but it's not quite the same as it doesn't build the assoc array with the
name
element, so it may actually be returning a string (I don't know exactly what$this->getExtension('Atom')->getAuthors()
returns).The PHPDocs need to be made consistent, and/or the function needs to be modified so it really does return a string and not an array. Altering the return type would be a BC break, even though it's not meant to work that way, so I suspect the PHPdoc change would be more appropriate.
The text was updated successfully, but these errors were encountered: