Merge pull request #7476 from owncloud/type-hinting

Type hinting
This commit is contained in:
Thomas Müller 2014-04-03 20:02:27 +02:00
commit 20f26068e7
18 changed files with 34 additions and 37 deletions

View File

@ -218,8 +218,8 @@ class AppConfig implements \OCP\IAppConfig {
/** /**
* get multiply values, either the app or key can be used as wildcard by setting it to false * get multiply values, either the app or key can be used as wildcard by setting it to false
* *
* @param boolean $app * @param string|false $app
* @param string $key * @param string|false $key
* @return array * @return array
*/ */
public function getValues($app, $key) { public function getValues($app, $key) {

View File

@ -97,7 +97,7 @@ class Cache {
/** /**
* creates cache key based on the files given * creates cache key based on the files given
* @param $files * @param string[] $files
* @return string * @return string
*/ */
static public function generateCacheKeyFromFiles($files) { static public function generateCacheKeyFromFiles($files) {

View File

@ -47,7 +47,7 @@ namespace OC {
* This function can be used to delete the contact identified by the given id * This function can be used to delete the contact identified by the given id
* *
* @param object $id the unique identifier to a contact * @param object $id the unique identifier to a contact
* @param $address_book_key * @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not * @return bool successful or not
*/ */
public function delete($id, $address_book_key) { public function delete($id, $address_book_key) {
@ -66,7 +66,7 @@ namespace OC {
* Otherwise the contact will be updated by replacing the entire data set. * Otherwise the contact will be updated by replacing the entire data set.
* *
* @param array $properties this array if key-value-pairs defines a contact * @param array $properties this array if key-value-pairs defines a contact
* @param $address_book_key string to identify the address book in which the contact shall be created or updated * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array representing the contact just created or updated * @return array representing the contact just created or updated
*/ */
public function createOrUpdate($properties, $address_book_key) { public function createOrUpdate($properties, $address_book_key) {

View File

@ -313,9 +313,8 @@ class OC_DB {
/** /**
* @brief Insert a row if a matching row doesn't exists. * @brief Insert a row if a matching row doesn't exists.
* @param string $table. The table to insert into in the form '*PREFIX*tableName' * @param string $table The table to insert into in the form '*PREFIX*tableName'
* @param array $input. An array of fieldname/value pairs * @param array $input An array of fieldname/value pairs
* @param string $table
* @return boolean number of updated rows * @return boolean number of updated rows
*/ */
public static function insertIfNotExist($table, $input) { public static function insertIfNotExist($table, $input) {

View File

@ -34,7 +34,7 @@ class OC_Image {
/** /**
* @brief Get mime type for an image file. * @brief Get mime type for an image file.
* @param string|null $filepath The path to a local image file. * @param string|null $filePath The path to a local image file.
* @return string The mime type if the it could be determined, otherwise an empty string. * @return string The mime type if the it could be determined, otherwise an empty string.
*/ */
static public function getMimeTypeForFile($filePath) { static public function getMimeTypeForFile($filePath) {

View File

@ -75,7 +75,7 @@ class OC_L10N implements \OCP\IL10N {
* get an L10N instance * get an L10N instance
* @param string $app * @param string $app
* @param string|null $lang * @param string|null $lang
* @return OC_L10N * @return \OC_L10N
*/ */
public static function get($app, $lang=null) { public static function get($app, $lang=null) {
if (is_null($lang)) { if (is_null($lang)) {
@ -89,7 +89,6 @@ class OC_L10N implements \OCP\IL10N {
* @brief The constructor * @brief The constructor
* @param string $app app requesting l10n * @param string $app app requesting l10n
* @param string $lang default: null Language * @param string $lang default: null Language
* @returns OC_L10N-Object
* *
* If language is not set, the constructor tries to find the right * If language is not set, the constructor tries to find the right
* language. * language.
@ -352,7 +351,7 @@ class OC_L10N implements \OCP\IL10N {
/** /**
* @brief Localization * @brief Localization
* @param string $type Type of localization * @param string $type Type of localization
* @param $params parameters for this localization * @param array $data parameters for this localization
* @returns String or false * @returns String or false
* *
* Returns the localized data. * Returns the localized data.

View File

@ -116,8 +116,6 @@ class OC_Appconfig {
/** /**
* get multiply values, either the app or key can be used as wildcard by setting it to false * get multiply values, either the app or key can be used as wildcard by setting it to false
* *
* @param app
* @param key
* @param string|false $app * @param string|false $app
* @param string|false $key * @param string|false $key
* @return array * @return array

View File

@ -63,8 +63,8 @@ class OC_Config {
/** /**
* @brief Gets a value from config.php * @brief Gets a value from config.php
* @param string $key key * @param string $key key
* @param string $default = null default value * @param mixed $default = null default value
* @return string the value or $default * @return mixed the value or $default
* *
* This function gets the value from config.php. If it does not exist, * This function gets the value from config.php. If it does not exist,
* $default will be returned. * $default will be returned.
@ -76,7 +76,7 @@ class OC_Config {
/** /**
* @brief Sets a value * @brief Sets a value
* @param string $key key * @param string $key key
* @param string $value value * @param mixed $value value
* *
* This function sets the value and writes the config.php. * This function sets the value and writes the config.php.
* *

View File

@ -302,7 +302,7 @@ class Server extends SimpleContainer implements IServerContainer {
/** /**
* get an L10N instance * get an L10N instance
* @param $app string appid * @param string $app appid
* @return \OC_L10N * @return \OC_L10N
*/ */
function getL10N($app) { function getL10N($app) {

View File

@ -30,7 +30,6 @@ class MailNotifications {
/** /**
* *
* @param string $recipient user id
* @param string $sender user id (if nothing is set we use the currently logged-in user) * @param string $sender user id (if nothing is set we use the currently logged-in user)
*/ */
public function __construct($sender = null) { public function __construct($sender = null) {

View File

@ -77,7 +77,7 @@ class Base {
/** /**
* @brief Appends a variable * @brief Appends a variable
* @param string $key key * @param string $key key
* @param string $value value * @param mixed $value value
* @return boolean|null * @return boolean|null
* *
* This function assigns a variable in an array context. If the key already * This function assigns a variable in an array context. If the key already

View File

@ -96,7 +96,7 @@ namespace OCP\Contacts {
* This function can be used to delete the contact identified by the given id * This function can be used to delete the contact identified by the given id
* *
* @param object $id the unique identifier to a contact * @param object $id the unique identifier to a contact
* @param $address_book_key * @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not * @return bool successful or not
*/ */
function delete($id, $address_book_key); function delete($id, $address_book_key);
@ -106,7 +106,7 @@ namespace OCP\Contacts {
* Otherwise the contact will be updated by replacing the entire data set. * Otherwise the contact will be updated by replacing the entire data set.
* *
* @param array $properties this array if key-value-pairs defines a contact * @param array $properties this array if key-value-pairs defines a contact
* @param $address_book_key string to identify the address book in which the contact shall be created or updated * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array representing the contact just created or updated * @return array representing the contact just created or updated
*/ */
function createOrUpdate($properties, $address_book_key); function createOrUpdate($properties, $address_book_key);

View File

@ -55,9 +55,8 @@ interface IAppConfig {
/** /**
* get multiply values, either the app or key can be used as wildcard by setting it to false * get multiply values, either the app or key can be used as wildcard by setting it to false
* *
* @param app * @param string|false $key
* @param key * @param string|false $app
* @param string $key
* @return array * @return array
*/ */
public function getValues($app, $key); public function getValues($app, $key);

View File

@ -23,7 +23,7 @@ namespace OCP;
interface IL10N { interface IL10N {
/** /**
* Translating * Translating
* @param $text String The text we need a translation for * @param string $text The text we need a translation for
* @param array $parameters default:array() Parameters for sprintf * @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text * @return \OC_L10N_String Translation or the same text
* *
@ -34,9 +34,9 @@ interface IL10N {
/** /**
* Translating * Translating
* @param $text_singular String the string to translate for exactly one object * @param string $text_singular the string to translate for exactly one object
* @param $text_plural String the string to translate for n objects * @param string $text_plural the string to translate for n objects
* @param $count Integer Number of objects * @param integer $count Number of objects
* @param array $parameters default:array() Parameters for sprintf * @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text * @return \OC_L10N_String Translation or the same text
* *
@ -51,8 +51,8 @@ interface IL10N {
/** /**
* Localization * Localization
* @param $type Type of localization * @param string $type Type of localization
* @param $params parameters for this localization * @param array $data parameters for this localization
* @return String or false * @return String or false
* *
* Returns the localized data. * Returns the localized data.

View File

@ -122,7 +122,7 @@ interface IServerContainer {
/** /**
* get an L10N instance * get an L10N instance
* @param $app string appid * @param string $app appid
* @return \OCP\IL10N * @return \OCP\IL10N
*/ */
function getL10N($app); function getL10N($app);

View File

@ -106,8 +106,8 @@ class Controller {
/** /**
* Get the field name to use it in error messages * Get the field name to use it in error messages
* *
* @param $setting string * @param string $setting
* @param $l \OC_L10N * @param \OC_L10N $l
* @return string * @return string
*/ */
public static function getFieldname($setting, $l) { public static function getFieldname($setting, $l) {

View File

@ -166,9 +166,9 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @param $verb * @param string $verb
* @param $controllerName * @param string $controllerName
* @param $actionName * @param string $actionName
* @return \PHPUnit_Framework_MockObject_MockObject * @return \PHPUnit_Framework_MockObject_MockObject
*/ */
private function mockRoute($verb, $controllerName, $actionName) private function mockRoute($verb, $controllerName, $actionName)

View File

@ -71,6 +71,9 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
$this->assertTableNotExist($this->table2); $this->assertTableNotExist($this->table2);
} }
/**
* @param string $table
*/
public function tableExist($table) { public function tableExist($table) {
switch (OC_Config::getValue( 'dbtype', 'sqlite' )) { switch (OC_Config::getValue( 'dbtype', 'sqlite' )) {