]> git.mxchange.org Git - friendica.git/commitdiff
Fix types in doc blocks/prototypes
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 21:51:59 +0000 (16:51 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 23 Jan 2019 14:06:58 +0000 (09:06 -0500)
14 files changed:
src/Content/Widget/TagCloud.php
src/Core/Console.php
src/Core/Renderer.php
src/Core/StorageManager.php
src/Model/Attach.php
src/Model/Mail.php
src/Model/Photo.php
src/Object/Image.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Email.php
src/Protocol/OStatus.php
src/Util/Temporal.php
src/Util/XML.php

index d775d010a81175e743fbdb5d38cc1aa37f5ef9fb..f2b94b11140f0504ed42ced3beaa34bbbc70f840 100644 (file)
@@ -113,7 +113,7 @@ class TagCloud
         * @param array $arr Array of tags/terms with tag/term name and total count of use.
         * @return array     Alphabetical sorted array of used tags/terms of an user.
         */
-       private static function tagCalc($arr)
+       private static function tagCalc(array $arr)
        {
                $tags = [];
                $min = 1e9;
index 32e12fa1f032ef38e735fa03c6a88ff11f1d52f8..c60f36296a56010c2d2be0c4d2c87187654639d3 100644 (file)
@@ -121,6 +121,7 @@ HELP;
 
                $className = $this->subConsoles[$command];
 
+               /** @var Console $subconsole */
                $subconsole = new $className($subargs);
 
                foreach ($this->options as $name => $value) {
index 9d2a7e22e590de810dcd9a0cd1b5a3298c903412..67bc5e3babc515a6377d9b013a6e20d018d349b5 100644 (file)
@@ -8,6 +8,7 @@ namespace Friendica\Core;
 use Exception;
 use Friendica\BaseObject;
 use Friendica\Render\FriendicaSmarty;
+use Friendica\Render\ITemplateEngine;
 
 /**
  * @brief This class handles Renderer related functions.
index 415ee522b648086f540c8259867925fdb49e57f2..cfefa5f35a7dcc91738a2d63d9bc500221d6aa4b 100644 (file)
@@ -3,6 +3,7 @@
 namespace Friendica\Core;
 
 use Friendica\Database\DBA;
+use Friendica\Model\Storage\IStorage;
 
 
 /**
@@ -138,6 +139,7 @@ class StorageManager
                                while($r = DBA::fetch($rr)) {
                                        $id = $r['id'];
                                        $data = $r['data'];
+                                       /** @var IStorage $backendClass */
                                        $backendClass = $r['backend-class'];
                                        $backendRef = $r['backend-ref'];
                                        if (!is_null($backendClass) && $backendClass !== '') {
@@ -146,6 +148,7 @@ class StorageManager
                                        }
                                        
                                        Logger::log("save data to new backend " . $dest);
+                                       /** @var IStorage $dest */
                                        $ref = $dest::put($data);
                                        Logger::log("saved data as " . $ref);
 
index 3bd77ef9c98bd3715ffbfb978d940a7dc026492b..7efb56f95a03a87fcd38dc5823aa73b5de2a5883 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Core\System;
 use Friendica\Core\StorageManager;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\Model\Storage\IStorage;
 use Friendica\Object\Image;
 use Friendica\Util\Security;
 use Friendica\Util\DateTimeFormat;
@@ -186,6 +187,7 @@ class Attach extends BaseObject
                        $filesize = strlen($data);
                }
 
+               /** @var IStorage $backend_class */
                $backend_class = StorageManager::getBackend();
                $backend_ref = '';
                if ($backend_class !== '') {
@@ -265,6 +267,7 @@ class Attach extends BaseObject
                        $items = self::select(['backend-class','backend-ref'], $conditions);
 
                        foreach($items as $item) {
+                               /** @var IStorage $backend_class */
                                $backend_class = (string)$item['backend-class'];
                                if ($backend_class !== '') {
                                        $fields['backend-ref'] = $backend_class::put($img->asString(), $item['backend-ref']);
@@ -297,6 +300,7 @@ class Attach extends BaseObject
                $items = self::select(['backend-class','backend-ref'], $conditions);
 
                foreach($items as $item) {
+                       /** @var IStorage $backend_class */
                        $backend_class = (string)$item['backend-class'];
                        if ($backend_class !== '') {
                                $backend_class::delete($item['backend-ref']);
index b9ed609fa1258851caadcaea61cc73256d378e09..2d304e55f8b92142544fd65781a424af44b56880 100644 (file)
@@ -157,7 +157,7 @@ class Mail
        }
 
        /**
-        * @param string $recipient recipient, default empty
+        * @param array  $recipient recipient, default empty
         * @param string $body      message body, default empty
         * @param string $subject   message subject, default empty
         * @param string $replyto   reply to, default empty
@@ -165,7 +165,7 @@ class Mail
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       public static function sendWall($recipient = '', $body = '', $subject = '', $replyto = '')
+       public static function sendWall(array $recipient = [], $body = '', $subject = '', $replyto = '')
        {
                if (!$recipient) {
                        return -1;
index 1cee2f633becf122a3ebb8dfa8bde55199b1d6fb..0778bf41969d4ce346c41553e75f1fda79ff2c4a 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\System;
 use Friendica\Core\StorageManager;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\Model\Storage\IStorage;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
@@ -268,6 +269,7 @@ class Photo extends BaseObject
                $data = "";
                $backend_ref = "";
 
+               /** @var IStorage $backend_class */
                if (DBA::isResult($existing_photo)) {
                        $backend_ref = (string)$existing_photo["backend-ref"];
                        $backend_class = (string)$existing_photo["backend-class"];
@@ -334,6 +336,7 @@ class Photo extends BaseObject
                $photos = self::select(["backend-class","backend-ref"], $conditions);
 
                foreach($photos as $photo) {
+                       /** @var IStorage $backend_class */
                        $backend_class = (string)$photo["backend-class"];
                        if ($backend_class !== "") {
                                $backend_class::delete($photo["backend-ref"]);
@@ -363,6 +366,7 @@ class Photo extends BaseObject
                        $photos = self::select(["backend-class","backend-ref"], $conditions);
 
                        foreach($photos as $photo) {
+                               /** @var IStorage $backend_class */
                                $backend_class = (string)$photo["backend-class"];
                                if ($backend_class !== "") {
                                        $fields["backend-ref"] = $backend_class::put($img->asString(), $photo["backend-ref"]);
@@ -479,7 +483,7 @@ class Photo extends BaseObject
        }
 
        /**
-        * @param string $exifCoord coordinate
+        * @param array $exifCoord coordinate
         * @param string $hemi      hemi
         * @return float
         */
index 1fe0a048b95c2d0d9be6a939ef5a76e200f61735..9143c23c16b3d2d15f095a097832df604365d6d1 100644 (file)
@@ -23,6 +23,7 @@ use ImagickPixel;
  */
 class Image
 {
+       /** @var Imagick|resource */
        private $image;
 
        /*
index cf6080c572d440fde1c26b2beb3de7d48ac28ed7..e6524de965e418f2cf9315cd9bb9abfffd2cc414 100644 (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
index e9d3be805f15f75013049d1e7edb87d2fe892c8c..34bdf2e876bf16dfe6d37b85f42ccd664280ce5f 100644 (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
         */
index 05d59a1525fd04ef395fd86635faa59aec128c32..a6090ce91f6a75dd9101bec6927bf394749ec87a 100644 (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)
index b1cc4f40203d22069cd7f35f37854b895568dcfa..b2d0004c06ef7fd7e1da8dd50c7695d069337384 100644 (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);
index 0e9baf2498fa30630bf112aafc6da1cdc8b6ecbc..ec71ab5e963e4604f7c8c072ff1c11295f7bc3b7 100644 (file)
@@ -158,10 +158,10 @@ class Temporal
        /**
         * @brief Returns a date selector
         *
-        * @param string $min     Unix timestamp of minimum date
-        * @param string $max     Unix timestap of maximum date
-        * @param string $default Unix timestamp of default date
-        * @param string $id      ID and name of datetimepicker (defaults to "datetimepicker")
+        * @param DateTime $min     Minimum date
+        * @param DateTime $max     Maximum date
+        * @param DateTime $default Default date
+        * @param string   $id      ID and name of datetimepicker (defaults to "datetimepicker")
         *
         * @return string Parsed HTML output.
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
index d56b2311f3b746d8aac24fffcae7894c45461977..ba146ec7b8172298180ca36ae82acd52f2d041f3 100644 (file)
@@ -135,14 +135,14 @@ class XML
        /**
         * @brief Create an XML element
         *
-        * @param object $doc        XML root
-        * @param string $element    XML element name
-        * @param string $value      XML value
-        * @param array  $attributes array containing the attributes
+        * @param \DOMDocument $doc        XML root
+        * @param string       $element    XML element name
+        * @param string       $value      XML value
+        * @param array        $attributes array containing the attributes
         *
-        * @return object XML element object
+        * @return \DOMElement XML element object
         */
-       public static function createElement($doc, $element, $value = "", $attributes = [])
+       public static function createElement(\DOMDocument $doc, $element, $value = "", $attributes = [])
        {
                $element = $doc->createElement($element, self::escape($value));
 
@@ -157,14 +157,14 @@ class XML
        /**
         * @brief Create an XML and append it to the parent object
         *
-        * @param object $doc        XML root
+        * @param \DOMDocument $doc        XML root
         * @param object $parent     parent object
         * @param string $element    XML element name
         * @param string $value      XML value
         * @param array  $attributes array containing the attributes
         * @return void
         */
-       public static function addElement($doc, $parent, $element, $value = "", $attributes = [])
+       public static function addElement(\DOMDocument $doc, $parent, $element, $value = "", $attributes = [])
        {
                $element = self::createElement($doc, $element, $value, $attributes);
                $parent->appendChild($element);
@@ -402,11 +402,11 @@ class XML
        /**
         * @brief Delete a node in a XML object
         *
-        * @param object $doc  XML document
+        * @param \DOMDocument $doc  XML document
         * @param string $node Node name
         * @return void
         */
-       public static function deleteNode(&$doc, $node)
+       public static function deleteNode(\DOMDocument $doc, $node)
        {
                $xpath = new DOMXPath($doc);
                $list = $xpath->query("//".$node);
@@ -431,7 +431,7 @@ class XML
                return $x;
        }
 
-       public static function getFirstNodeValue($xpath, $element, $context = null)
+       public static function getFirstNodeValue(DOMXPath $xpath, $element, $context = null)
        {
                $result = $xpath->evaluate($element, $context);
                if (!is_object($result)) {
@@ -446,7 +446,7 @@ class XML
                return $first_item->nodeValue;
        }
 
-       public static function getFirstAttributes($xpath, $element, $context = null)
+       public static function getFirstAttributes(DOMXPath $xpath, $element, $context = null)
        {
                $result = $xpath->query($element, $context);
                if (!is_object($result)) {