]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Stronger typing, require array where param array
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 29 Aug 2013 08:27:39 +0000 (10:27 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 29 Aug 2013 08:27:39 +0000 (10:27 +0200)
classes/File.php
classes/Managed_DataObject.php
classes/Memcached_DataObject.php
classes/Notice.php
classes/Profile_list.php
classes/Safe_DataObject.php
classes/Status_network.php
classes/User.php

index 995927ba1a5aba423cb3d876564c081a8a6e2904..7e59bf2b8a7a4656c2247fce4e9f558fbb60a511 100644 (file)
@@ -113,7 +113,7 @@ class File extends Managed_DataObject
      * @param string $given_url
      * @return boolean success
      */
-    public function saveOembed($redir_data, $given_url)
+    public function saveOembed(array $redir_data, $given_url)
     {
         if (isset($redir_data['type'])
             && (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21)))
index 4ec8de669d3dd4abd39f43450e587dfd35e2d945..e957e7ba8f505a120c4ab45dbce668ce2bfae121 100644 (file)
@@ -56,7 +56,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
      * @return get_called_class() object if found, or null for no hits
      *
      */
-    static function pkeyGet($kv)
+    static function pkeyGet(array $kv)
     {
         return parent::pkeyGetClass(get_called_class(), $kv);
     }
@@ -82,13 +82,13 @@ abstract class Managed_DataObject extends Memcached_DataObject
      * values for a specific key column. Usually used for the primary key when
      * multiple values are desired.
      *
-     * @param array $keyCol  key column name
-     * @param array $keyVals array of key values
+     * @param string $keyCol  key column name
+     * @param array  $keyVals array of key values
      *
      * @return get_called_class() object with multiple instances if found, or null for no hits
      *
      */
-    static function listGet($keyCol, $keyVals)
+    static function listGet($keyCol, array $keyVals)
     {
         return parent::listGetClass(get_called_class(), $keyCol, $keyVals);
     }
index 262f83b83ccfb99b137d33099c21d135ff073b61..5778ad95424774a57c8e207b50bf0bbc3d994d81 100644 (file)
@@ -74,7 +74,7 @@ class Memcached_DataObject extends Safe_DataObject
      *
      * @return array Array of objects, in order
      */
-    function multiGet($cls, $keyCol, $keyVals, $skipNulls=true)
+    function multiGet($cls, $keyCol, array $keyVals, $skipNulls=true)
     {
         $result = self::pivotGetClass($cls, $keyCol, $keyVals);
 
@@ -264,7 +264,7 @@ class Memcached_DataObject extends Safe_DataObject
         return $pkey;
     }
 
-    static function listGetClass($cls, $keyCol, $keyVals)
+    static function listGetClass($cls, $keyCol, array $keyVals)
     {
         if (!is_a($cls, __CLASS__, true)) {
             throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
@@ -348,7 +348,7 @@ class Memcached_DataObject extends Safe_DataObject
     /**
      * @todo FIXME: Should this return false on lookup fail to match getKV?
      */
-    static function pkeyGetClass($cls, $kv)
+    static function pkeyGetClass($cls, array $kv)
     {
         if (!is_a($cls, __CLASS__, true)) {
             throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
index e71b63ba47b9c91887a5169a98a554a583a0eb45..630da81106543d604274893a892c33981896d206 100644 (file)
@@ -319,7 +319,7 @@ class Notice extends Managed_DataObject
      * @return Notice
      * @throws ClientException
      */
-    static function saveNew($profile_id, $content, $source, $options=null) {
+    static function saveNew($profile_id, $content, $source, array $options=null) {
         $defaults = array('uri' => null,
                           'url' => null,
                           'reply_to' => null,
@@ -954,7 +954,7 @@ class Notice extends Managed_DataObject
      *              if left empty, will be loaded from reply records
      * @return array associating recipient user IDs with an inbox source constant
      */
-    function whoGets($groups=null, $recipients=null)
+    function whoGets(array $groups=null, array $recipients=null)
     {
         $c = self::memcache();
 
@@ -1065,7 +1065,7 @@ class Notice extends Managed_DataObject
      * @param array $recipient optional list of reply profile ids
      *              if left empty, will be loaded from reply records
      */
-    function addToInboxes($groups=null, $recipients=null)
+    function addToInboxes(array $groups=null, array $recipients=null)
     {
         $ni = $this->whoGets($groups, $recipients);
 
@@ -1251,9 +1251,9 @@ class Notice extends Managed_DataObject
      *
      * Mail notifications etc will be handled later.
      *
-     * @param array of unique identifier URIs for recipients
+     * @param array  $uris   Array of unique identifier URIs for recipients
      */
-    function saveKnownReplies($uris)
+    function saveKnownReplies(array $uris)
     {
         if (empty($uris)) {
             return;
index 0d6c6f284de9e7b9f477c9c0d260aa858d409ff8..b922c92a146ad32260bdedb71c9bbd6742272b78 100644 (file)
@@ -602,7 +602,7 @@ class Profile_list extends Managed_DataObject
      *
      * @return mixed Profile_list on success, false on fail
      */
-    static function saveNew($fields) {
+    static function saveNew(array $fields) {
         extract($fields);
 
         $ptag = new Profile_list();
@@ -713,7 +713,7 @@ class Profile_list extends Managed_DataObject
 
      // XXX: This should be in Memcached_DataObject... eventually.
 
-    static function getAtCursor($fn, $args, $cursor, $count=20)
+    static function getAtCursor($fn, array $args, $cursor, $count=20)
     {
         $items = array();
 
@@ -886,7 +886,7 @@ class Profile_list extends Managed_DataObject
      * @return Profile_list results
      */
 
-    static function getByKeys($keys) {
+    static function getByKeys(array $keys) {
         $cache = Cache::instance();
 
         if (!empty($cache)) {
index 891e33a668ad665929f2db96668c85de64e51646..622b57f2900a291529a48be2a9442d7f3ea6abfc 100644 (file)
@@ -108,7 +108,7 @@ class Safe_DataObject extends DB_DataObject
      * @return mixed
      * @throws Exception
      */
-    function __call($method, $params)
+    function __call($method, array $params)
     {
         $return = null;
         // Yes, that's _call with one underscore, which does the
@@ -259,7 +259,7 @@ class Safe_DataObject extends DB_DataObject
      * @param array of .ini file names $schemas
      * @return array
      */
-    protected function parseIniFiles($schemas)
+    protected function parseIniFiles(array $schemas)
     {
         $key = implode("|", $schemas);
         if (!isset(Safe_DataObject::$iniCache[$key])) {
index 0376f1e69d5b59bbced5aedc9dc6f7d8e88bcecf..7d6e9461136dbbb007b03f9de5a24ab8098e4002 100644 (file)
@@ -70,7 +70,7 @@ class Status_network extends Safe_DataObject
      * @param string $dbname
      * @param array $servers memcached servers to use for caching config info
      */
-    static function setupDB($dbhost, $dbuser, $dbpass, $dbname, $servers)
+    static function setupDB($dbhost, $dbuser, $dbpass, $dbname, array $servers)
     {
         global $config;
 
@@ -333,7 +333,7 @@ class Status_network extends Safe_DataObject
      * @param array tags
      * @fixme only add/remove differentials
      */
-    function setTags($tags)
+    function setTags(array $tags)
     {
         $this->clearTags();
         foreach ($tags as $tag) {
index c4a2288444253e2a88358c098354d3f4fd3d4aed..55057574dbbe617fcd3062a5bb03e1fd682be174 100644 (file)
@@ -260,7 +260,7 @@ class User extends Managed_DataObject
      *              ?string 'uri' permalink to notice; defaults to local notice URL
      * @return mixed User object or false on failure
      */
-    static function register($fields) {
+    static function register(array $fields) {
 
         // MAGICALLY put fields into current scope