Skip to content

Commit

Permalink
Fix signatures, missing returns for edge cases etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralflang committed Oct 8, 2022
1 parent b9801b8 commit 4097880
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 14 deletions.
6 changes: 4 additions & 2 deletions lib/Api.php
Expand Up @@ -1814,6 +1814,7 @@ public function addField($address = '', $name = '', $field = '',
throw new Turba_Exception(_("Permission denied"));
}

$res = [];
try {
$res = $driver->search(array('email' => trim($address)), null, 'AND');
} catch (Turba_Exception $e) {
Expand Down Expand Up @@ -2419,6 +2420,7 @@ public function searchTags($names, $max = 10, $from = 0,
$resource_type = '', $user = null, $raw = false)
{
global $injector, $registry;
$sources = [];

$results = $injector
->getInstance('Turba_Tagger')
Expand All @@ -2443,7 +2445,7 @@ public function searchTags($names, $max = 10, $from = 0,
if (count($result) == 0) {
continue;
} elseif (count($result) > 1) {
throw new Turba_Exception(sprintf("Internal Horde Error: multiple Turba objects with same objectId %s.", $uid));
throw new Turba_Exception(sprintf("Internal Horde Error: multiple Turba objects with same objectId %s.", $contact_uid));
}
foreach ($result->objects as $obj) {
$return[] = array(
Expand Down Expand Up @@ -2550,7 +2552,7 @@ protected function _encodeContent($content)
$out[$attr] = $hooks->callHook(
'encode_attribute',
'turba',
array($attr, $value, null, null)
array($attr, $val, null, null)
);
} catch (Turba_Exception $e) {}
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Application.php
Expand Up @@ -342,6 +342,7 @@ public function configSpecialValues($what)
$addressbooks[''] = _("None");
return $addressbooks;
}
return [];
}

/**
Expand Down Expand Up @@ -846,6 +847,7 @@ public function download(Horde_Variables $vars)

break;
}
return [];
}

/**
Expand Down Expand Up @@ -1113,6 +1115,7 @@ public function davPutObject($collection, $object, $data)
$dav->addObjectMap($id, $object, $internal);
}
}
return null;
}

/**
Expand Down Expand Up @@ -1140,6 +1143,7 @@ public function davDeleteObject($collection, $object)
$dav->deleteExternalObjectId($object, $internal);
} catch (Horde_Dav_Exception $e) {
}
return true;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Backup/Contacts.php
Expand Up @@ -94,14 +94,14 @@ public function key()

/**
*/
public function next()
public function next(): void
{
$this->_list->next();
}

/**
*/
public function rewind()
public function rewind(): void
{
if (!isset($this->_driver->map['__owner'])) {
$this->_list = new EmptyIterator();
Expand All @@ -115,7 +115,7 @@ public function rewind()

/**
*/
public function valid()
public function valid(): bool
{
return $this->_list->valid();
}
Expand Down
1 change: 1 addition & 0 deletions lib/Driver/Favourites.php
Expand Up @@ -122,6 +122,7 @@ protected function _match($contact, $val)
return empty($val['test']) ||
stristr($contact[$val['field']], $val['test']) !== false;
}
return false;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Driver/Group.php
Expand Up @@ -15,6 +15,8 @@
*/
class Turba_Driver_Group extends Turba_Driver
{

protected $_gid;
/**
* Constructor function.
*
Expand Down
6 changes: 4 additions & 2 deletions lib/Driver/Prefs.php
Expand Up @@ -104,6 +104,8 @@ protected function _delete($object_key, $object_id)
* Saves the specified object in the preferences.
*
* @param Turba_Object $object TODO
*
* @return string object id
*/
function _save($object)
{
Expand All @@ -114,6 +116,7 @@ function _save($object)
$book = $this->_getAddressBook();
$book[$object_id] = $attributes;
$this->_setAddressBook($book);
return (string) $object_id;
}

/**
Expand All @@ -139,9 +142,8 @@ protected function _getAddressBook()
*
* @param $addressbook TODO
*
* @return TODO
*/
protected function _setAddressBook($addressbook)
protected function _setAddressBook($addressbook): void
{
global $prefs;

Expand Down
2 changes: 1 addition & 1 deletion lib/Driver/Sql.php
Expand Up @@ -65,7 +65,7 @@ public function __construct($name = '', array $params = array())
*
* @return integer The number of contacts that the user owns.
*/
public function count()
public function count(): int
{
$test = $this->getContactOwner();
if (!isset($this->_countCache[$test])) {
Expand Down
2 changes: 2 additions & 0 deletions lib/Driver/Vbook.php
Expand Up @@ -35,6 +35,8 @@ class Turba_Driver_Vbook extends Turba_Driver
*/
protected $_driver;

protected $_share;

/**
* Constructs a new Turba_Driver object.
*
Expand Down
11 changes: 9 additions & 2 deletions lib/Form/EditContactGroup.php
Expand Up @@ -36,9 +36,16 @@ public function __construct($vars, $contact)
}
}

public function renderActive($renderer, $vars, $action, $method)
public function renderActive(
$renderer = null,
$vars = null,
$action = '',
$method = 'get',
$enctype = null,
$focus = true
)
{
parent::renderActive($renderer, $vars, $action, $method);
parent::renderActive($renderer, $vars, $action, $method, $enctype, $focus);

$results = new Turba_List($vars->get('objectkeys'));

Expand Down
4 changes: 2 additions & 2 deletions lib/List.php
Expand Up @@ -26,7 +26,7 @@ class Turba_List implements Countable
/**
* The field to compare objects by.
*
* @var string
* @var iterable
*/
protected $_usortCriteria;

Expand Down Expand Up @@ -254,7 +254,7 @@ protected function _cmp(Turba_Object $a, Turba_Object $b)

/* Countable methods. */

public function count()
public function count(): int
{
return count($this->objects);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Test.php
Expand Up @@ -96,7 +96,7 @@ public function appTests()
*/
protected function _doConnectionTest($params)
{
$ret .= 'server="' . htmlspecialchars($params['server']) . '" ' .
$ret = 'server="' . htmlspecialchars($params['server']) . '" ' .
'basedn="' . htmlspecialchars($params['basedn']) . '" ' .
'filter="' . htmlspecialchars($params['filter']) . '"<br />';

Expand Down
2 changes: 1 addition & 1 deletion lib/View/List.php
Expand Up @@ -511,7 +511,7 @@ public function getAddSources()
*
* @return integer The number of objects in the list.
*/
public function count()
public function count(): int
{
return $this->list->count();
}
Expand Down

0 comments on commit 4097880

Please sign in to comment.