Fix types in doc blocks/prototypes

This commit is contained in:
Hypolite Petovan 2019-01-21 16:51:59 -05:00
parent 5ea033db33
commit 64847e7cc8
14 changed files with 91 additions and 77 deletions

View file

@ -529,17 +529,17 @@ class DFRN
/**
* @brief Adds the header elements for the DFRN protocol
*
* @param object $doc XML document
* @param array $owner Owner record
* @param string $authorelement Element name for the author
* @param string $alternatelink link to profile or category
* @param bool $public Is it a header for public posts?
* @param DOMDocument $doc XML document
* @param array $owner Owner record
* @param string $authorelement Element name for the author
* @param string $alternatelink link to profile or category
* @param bool $public Is it a header for public posts?
*
* @return object XML root object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addHeader($doc, $owner, $authorelement, $alternatelink = "", $public = false)
private static function addHeader(DOMDocument $doc, $owner, $authorelement, $alternatelink = "", $public = false)
{
if ($alternatelink == "") {
@ -607,16 +607,16 @@ class DFRN
/**
* @brief Adds the author element in the header for the DFRN protocol
*
* @param object $doc XML document
* @param array $owner Owner record
* @param string $authorelement Element name for the author
* @param boolean $public boolean
* @param DOMDocument $doc XML document
* @param array $owner Owner record
* @param string $authorelement Element name for the author
* @param boolean $public boolean
*
* @return object XML author object
* @return \DOMElement XML author object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addAuthor($doc, $owner, $authorelement, $public)
private static function addAuthor(DOMDocument $doc, array $owner, $authorelement, $public)
{
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
$r = q(
@ -752,16 +752,16 @@ class DFRN
/**
* @brief Adds the author elements in the "entry" elements of the DFRN protocol
*
* @param object $doc XML document
* @param DOMDocument $doc XML document
* @param string $element Element name for the author
* @param string $contact_url Link of the contact
* @param array $item Item elements
*
* @return object XML author object
* @return \DOMElement XML author object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function addEntryAuthor($doc, $element, $contact_url, $item)
private static function addEntryAuthor(DOMDocument $doc, $element, $contact_url, $item)
{
$contact = Contact::getDetailsByURL($contact_url, $item["uid"]);
@ -795,15 +795,15 @@ class DFRN
/**
* @brief Adds the activity elements
*
* @param object $doc XML document
* @param string $element Element name for the activity
* @param string $activity activity value
* @param DOMDocument $doc XML document
* @param string $element Element name for the activity
* @param string $activity activity value
*
* @return object XML activity object
* @return \DOMElement XML activity object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo Find proper type-hints
*/
private static function createActivity($doc, $element, $activity)
private static function createActivity(DOMDocument $doc, $element, $activity)
{
if ($activity) {
$entry = $doc->createElement($element);
@ -898,20 +898,20 @@ class DFRN
/**
* @brief Adds the "entry" elements for the DFRN protocol
*
* @param object $doc XML document
* @param string $type "text" or "html"
* @param array $item Item element
* @param array $owner Owner record
* @param bool $comment Trigger the sending of the "comment" element
* @param int $cid Contact ID of the recipient
* @param bool $single If set, the entry is created as an XML document with a single "entry" element
* @param DOMDocument $doc XML document
* @param string $type "text" or "html"
* @param array $item Item element
* @param array $owner Owner record
* @param bool $comment Trigger the sending of the "comment" element
* @param int $cid Contact ID of the recipient
* @param bool $single If set, the entry is created as an XML document with a single "entry" element
*
* @return object XML entry object
* @return \DOMElement XML entry object
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @todo Find proper type-hints
*/
private static function entry($doc, $type, array $item, array $owner, $comment = false, $cid = 0, $single = false)
private static function entry(DOMDocument $doc, $type, array $item, array $owner, $comment = false, $cid = 0, $single = false)
{
$mentioned = [];
@ -2414,7 +2414,7 @@ class DFRN
* @param object $xpath XPath object
* @param object $entry entry elements
* @param array $importer Record of the importer user mixed with contact of the content
* @param object $xml xml
* @param string $xml xml
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException

View file

@ -648,15 +648,15 @@ class Diaspora
/**
* @brief Dispatches the different message types to the different functions
*
* @param array $importer Array of the importer user
* @param array $msg The post that will be dispatched
* @param object $fields SimpleXML object that contains the message
* @param array $importer Array of the importer user
* @param array $msg The post that will be dispatched
* @param SimpleXMLElement $fields SimpleXML object that contains the message
*
* @return int The message id of the generated message, "true" or "false" if there was an error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function dispatch(array $importer, $msg, $fields = null)
public static function dispatch(array $importer, $msg, SimpleXMLElement $fields = null)
{
// The sender is the handle of the contact that sent the message.
// This will often be different with relayed messages (for example "like" and "comment")
@ -758,7 +758,7 @@ class Diaspora
*
* @param array $msg Array with the XML, the sender handle and the sender signature
*
* @return bool|array If the posting is valid then an array with an SimpleXML object is returned
* @return bool|SimpleXMLElement If the posting is valid then an array with an SimpleXML object is returned
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
@ -1077,7 +1077,7 @@ class Diaspora
* @param int $uid The user id
* @param string $handle The handle in the format user@domain.tld
*
* @return int Contact id
* @return array Contact data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/

View file

@ -17,7 +17,7 @@ class Email
* @param string $mailbox The mailbox name
* @param string $username The username
* @param string $password The password
* @return object
* @return resource
* @throws \Exception
*/
public static function connect($mailbox, $username, $password)
@ -42,8 +42,8 @@ class Email
}
/**
* @param object $mbox mailbox
* @param string $email_addr email
* @param resource $mbox mailbox
* @param string $email_addr email
* @return array
* @throws \Exception
*/
@ -92,8 +92,8 @@ class Email
}
/**
* @param object $mbox mailbox
* @param integer $uid user id
* @param resource $mbox mailbox
* @param integer $uid user id
* @return mixed
*/
public static function messageMeta($mbox, $uid)
@ -103,9 +103,9 @@ class Email
}
/**
* @param object $mbox mailbox
* @param integer $uid user id
* @param string $reply reply
* @param resource $mbox mailbox
* @param integer $uid user id
* @param string $reply reply
* @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
@ -166,11 +166,11 @@ class Email
// At the moment - only return plain/text.
// Later we'll repackage inline images as data url's and make the HTML safe
/**
* @param object $mbox mailbox
* @param integer $uid user id
* @param object $p parts
* @param integer $partno part number
* @param string $subtype sub type
* @param resource $mbox mailbox
* @param integer $uid user id
* @param object $p parts
* @param integer $partno part number
* @param string $subtype sub type
* @return string
*/
private static function messageGetPart($mbox, $uid, $p, $partno, $subtype)

View file

@ -1453,7 +1453,7 @@ class OStatus
* @param array $owner Contact data of the poster
* @param bool $show_profile Whether to show profile
*
* @return object author element
* @return \DOMElement author element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function addAuthor(DOMDocument $doc, array $owner, $show_profile = true)
@ -1573,7 +1573,7 @@ class OStatus
* @param bool $toplevel optional default false
* @param bool $feed_mode Behave like a regular feed for users if true
*
* @return object Entry element
* @return \DOMElement Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
@ -1605,7 +1605,7 @@ class OStatus
* @param DOMDocument $doc XML document
* @param array $contact Array of the contact that is added
*
* @return object Source element
* @return \DOMElement Source element
* @throws \Exception
*/
private static function sourceEntry(DOMDocument $doc, array $contact)
@ -1748,7 +1748,7 @@ class OStatus
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return object Entry element with "like"
* @return \DOMElement Entry element with "like"
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
@ -1835,7 +1835,7 @@ class OStatus
* @param array $owner Contact data of the poster
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
*
* @return object Entry element
* @return \DOMElement Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
@ -1900,7 +1900,7 @@ class OStatus
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
* @param bool $feed_mode Behave like a regular feed for users if true
*
* @return object Entry element
* @return \DOMElement Entry element
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
@ -1976,7 +1976,7 @@ class OStatus
* @brief Adds elements to the XML document
*
* @param DOMDocument $doc XML document
* @param object $entry Entry element where the content is added
* @param \DOMElement $entry Entry element where the content is added
* @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster
* @param string $title Title for the post
@ -1986,7 +1986,7 @@ class OStatus
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function entryContent(DOMDocument $doc, $entry, array $item, array $owner, $title, $verb = "", $complete = true, $feed_mode = false)
private static function entryContent(DOMDocument $doc, \DOMElement $entry, array $item, array $owner, $title, $verb = "", $complete = true, $feed_mode = false)
{
if ($verb == "") {
$verb = self::constructVerb($item);