Prechádzať zdrojové kódy

Fix several comments syntaxes (#3615)

Mainly wrong `@return` types in comments
Alexandre Alapetite 4 rokov pred
rodič
commit
607f7e7254

+ 1 - 1
app/Controllers/feedController.php

@@ -32,7 +32,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 	 * @param int $cat_id
 	 * @param string $new_cat_name
 	 * @param string $http_auth
-	 * @return FreshRSS_Feed|the
+	 * @return FreshRSS_Feed
 	 * @throws FreshRSS_AlreadySubscribed_Exception
 	 * @throws FreshRSS_FeedNotAdded_Exception
 	 * @throws FreshRSS_Feed_Exception

+ 2 - 2
app/Models/ConfigurationSetter.php

@@ -4,7 +4,7 @@ class FreshRSS_ConfigurationSetter {
 	/**
 	 * Return if the given key is supported by this setter.
 	 * @param $key the key to test.
-	 * @return true if the key is supported, false else.
+	 * @return boolean true if the key is supported, false else.
 	 */
 	public function support($key) {
 		$name_setter = '_' . $key;
@@ -26,7 +26,7 @@ class FreshRSS_ConfigurationSetter {
 	 * A helper to set boolean values.
 	 *
 	 * @param $value the tested value.
-	 * @return true if value is true and different from no, false else.
+	 * @return boolean true if value is true and different from no, false else.
 	 */
 	private function handleBool($value) {
 		return ((bool)$value) && $value !== 'no';

+ 2 - 2
app/Models/Share.php

@@ -51,7 +51,7 @@ class FreshRSS_Share {
 
 	/**
 	 * Return the list of sharing options.
-	 * @return an array of FreshRSS_Share objects.
+	 * @return array[FreshRSS_Share]
 	 */
 	public static function enum() {
 		return self::$list_sharing;
@@ -255,7 +255,7 @@ class FreshRSS_Share {
 	 * Transform a data with the given functions.
 	 * @param $data the data to transform.
 	 * @param $tranform an array containing a list of functions to apply.
-	 * @return the transformed data.
+	 * @return mixed the transformed data.
 	 */
 	private static function transform($data, $transform) {
 		if (!is_array($transform) || empty($transform)) {

+ 4 - 9
app/Models/StatsDAO.php

@@ -57,9 +57,8 @@ SQL;
 
 	/**
 	 * Calculates entry count per day on a 30 days period.
-	 * Returns the result as a JSON object.
 	 *
-	 * @return JSON object
+	 * @return array
 	 */
 	public function calculateEntryCount() {
 		$count = $this->initEntryCountArray();
@@ -238,9 +237,7 @@ SQL;
 
 	/**
 	 * Calculates feed count per category.
-	 * Returns the result as a JSON object.
-	 *
-	 * @return JSON object
+	 * @return array
 	 */
 	public function calculateFeedByCategory() {
 		$sql = <<<SQL
@@ -259,9 +256,7 @@ SQL;
 
 	/**
 	 * Calculates entry count per category.
-	 * Returns the result as a JSON string.
-	 *
-	 * @return JSON object
+	 * @return array
 	 */
 	public function calculateEntryByCategory() {
 		$sql = <<<SQL
@@ -364,7 +359,7 @@ SQL;
 	 * Translates array content
 	 *
 	 * @param array $data
-	 * @return JSON object
+	 * @return array
 	 */
 	private function convertToTranslatedJson($data = array()) {
 		$translated = array_map(function($a) {

+ 2 - 2
lib/Minz/Configuration.php

@@ -43,7 +43,7 @@ class Minz_Configuration {
 	 * Return the configuration related to a given namespace.
 	 *
 	 * @param $namespace the name of the configuration to get.
-	 * @return a Minz_Configuration object
+	 * @return Minz_Configuration object
 	 * @throws Minz_ConfigurationNamespaceException if the namespace does not exist.
 	 */
 	public static function get($namespace) {
@@ -152,7 +152,7 @@ class Minz_Configuration {
 	 *
 	 * @param $key the name of the param.
 	 * @param $default default value to return if key does not exist.
-	 * @return the value corresponding to the key.
+	 * @return mixed value corresponding to the key.
 	 * @throws Minz_ConfigurationParamException if the param does not exist
 	 */
 	public function param($key, $default = null) {

+ 1 - 2
lib/Minz/Error.php

@@ -51,8 +51,7 @@ class Minz_Error {
 	 * Permet de retourner les logs de façon à n'avoir que
 	 * ceux que l'on veut réellement
 	 * @param $logs les logs rangés par catégories (error, warning, notice)
-	 * @return la liste des logs, sans catégorie,
-	 *       > en fonction de l'environment
+	 * @return array liste des logs, sans catégorie, en fonction de l'environment
 	 */
 	private static function processLogs ($logs) {
 		$conf = Minz_Configuration::get('system');

+ 2 - 3
lib/Minz/Extension.php

@@ -93,8 +93,7 @@ abstract class Minz_Extension {
 	/**
 	 * Return the content of the configure view for the current extension.
 	 *
-	 * @return the html content from ext_dir/configure.phtml, false if it does
-	 *         not exist.
+	 * @return string html content from ext_dir/configure.phtml, false if it does not exist.
 	 */
 	public function getConfigureView() {
 		$filename = $this->path . '/configure.phtml';
@@ -149,7 +148,7 @@ abstract class Minz_Extension {
 	 * @param $filename name of the file to serve.
 	 * @param $type the type (js or css) of the file to serve.
 	 * @param $isStatic indicates if the file is a static file or a user file. Default is static.
-	 * @return the url corresponding to the file.
+	 * @return string url corresponding to the file.
 	 */
 	public function getFileUrl($filename, $type, $isStatic = true) {
 		if ($isStatic) {

+ 3 - 3
lib/Minz/ExtensionManager.php

@@ -296,7 +296,7 @@ class Minz_ExtensionManager {
 	 *
 	 * @param string $hook_name the hook to call.
 	 * @param additional parameters (for signature, please see self::$hook_list).
-	 * @return the final result of the called hook.
+	 * @return mixed final result of the called hook.
 	 */
 	public static function callHook($hook_name) {
 		if (!isset(self::$hook_list[$hook_name])) {
@@ -326,7 +326,7 @@ class Minz_ExtensionManager {
 	 *
 	 * @param $hook_name is the hook to call.
 	 * @param $arg is the argument to pass to the first extension hook.
-	 * @return the final chained result of the hooks. If nothing is changed,
+	 * @return mixed final chained result of the hooks. If nothing is changed,
 	 *         the initial argument is returned.
 	 */
 	private static function callOneToOne($hook_name, $arg) {
@@ -350,7 +350,7 @@ class Minz_ExtensionManager {
 	 * returned.
 	 *
 	 * @param string $hook_name is the hook to call.
-	 * @return a concatenated string, result of the call to all the hooks.
+	 * @return string concatenated result of the call to all the hooks.
 	 */
 	private static function callNoneToString($hook_name) {
 		$result = '';

+ 1 - 1
lib/Minz/FrontController.php

@@ -51,7 +51,7 @@ class Minz_FrontController {
 
 	/**
 	 * Retourne un tableau représentant l'url passée par la barre d'adresses
-	 * @return tableau représentant l'url
+	 * @return array représentant l'url
 	 */
 	private function buildUrl() {
 		$url = array();

+ 10 - 14
lib/Minz/Paginator.php

@@ -60,47 +60,43 @@ class Minz_Paginator {
 	/**
 	 * Permet de retrouver la page d'un élément donné
 	 * @param $item l'élément à retrouver
-	 * @return la page à laquelle se trouve l'élément (false si non trouvé)
+	 * @return float|false la page à laquelle se trouve l’élément, false si non trouvé
 	 */
 	public function pageByItem ($item) {
-		$page = false;
 		$i = 0;
 
 		do {
 			if ($item == $this->items[$i]) {
-				$page = ceil (($i + 1) / $this->nbItemsPerPage);
+				return ceil(($i + 1) / $this->nbItemsPerPage);
 			}
-
 			$i++;
-		} while (!$page && $i < $this->nbItems ());
+		} while ($i < $this->nbItems());
 
-		return $page;
+		return false;
 	}
 
 	/**
 	 * Permet de retrouver la position d'un élément donné (à partir de 0)
 	 * @param $item l'élément à retrouver
-	 * @return la position à laquelle se trouve l'élément (false si non trouvé)
+	 * @return float|false la position à laquelle se trouve l’élément, false si non trouvé
 	 */
 	public function positionByItem ($item) {
-		$find = false;
 		$i = 0;
 
 		do {
 			if ($item == $this->items[$i]) {
-				$find = true;
-			} else {
-				$i++;
+				return $i;
 			}
-		} while (!$find && $i < $this->nbItems ());
+			$i++;
+		} while ($i < $this->nbItems ());
 
-		return $i;
+		return false;
 	}
 
 	/**
 	 * Permet de récupérer un item par sa position
 	 * @param $pos la position de l'élément
-	 * @return l'item situé à $pos (dernier item si $pos<0, 1er si $pos>=count($items))
+	 * @return mixed item situé à $pos (dernier item si $pos<0, 1er si $pos>=count($items))
 	 */
 	public function itemByPosition ($pos) {
 		if ($pos < 0) {

+ 5 - 5
lib/Minz/Request.php

@@ -133,7 +133,7 @@ class Minz_Request {
 	/**
 	 * Try to guess the base URL from $_SERVER information
 	 *
-	 * @return the base url (e.g. http://example.com/)
+	 * @return string base url (e.g. http://example.com/)
 	 */
 	public static function guessBaseUrl() {
 		$protocol = static::extractProtocol();
@@ -224,7 +224,7 @@ class Minz_Request {
 	/**
 	 * Return the base_url from configuration and add a suffix if given.
 	 *
-	 * @return the base_url with a suffix.
+	 * @return string base_url with a suffix.
 	 */
 	public static function getBaseUrl() {
 		$conf = Minz_Configuration::get('system');
@@ -239,7 +239,7 @@ class Minz_Request {
 	 * localhost address.
 	 *
 	 * @param $address the address to test, can be an IP or a URL.
-	 * @return true if server is accessible, false otherwise.
+	 * @return boolean true if server is accessible, false otherwise.
 	 * @todo improve test with a more valid technique (e.g. test with an external server?)
 	 */
 	public static function serverIsPublic($address) {
@@ -363,7 +363,7 @@ class Minz_Request {
 	 * Permet de récupérer une variable de type $_GET
 	 * @param $param nom de la variable
 	 * @param $default valeur par défaut à attribuer à la variable
-	 * @return $_GET[$param]
+	 * @return string $_GET[$param]
 	 *         $_GET si $param = false
 	 *         $default si $_GET[$param] n'existe pas
 	 */
@@ -409,7 +409,7 @@ class Minz_Request {
 	 * Permet de récupérer une variable de type $_POST
 	 * @param $param nom de la variable
 	 * @param $default valeur par défaut à attribuer à la variable
-	 * @return $_POST[$param]
+	 * @return string $_POST[$param]
 	 *         $_POST si $param = false
 	 *         $default si $_POST[$param] n'existe pas
 	 */

+ 1 - 1
lib/Minz/Session.php

@@ -57,7 +57,7 @@ class Minz_Session {
 	/**
 	 * Permet de récupérer une variable de session
 	 * @param $p le paramètre à récupérer
-	 * @return la valeur de la variable de session, false si n'existe pas
+	 * @return mixed|false la valeur de la variable de session, false si n'existe pas
 	 */
 	public static function param($p, $default = false) {
 		return isset($_SESSION[$p]) ? $_SESSION[$p] : $default;

+ 3 - 3
lib/Minz/Translate.php

@@ -58,7 +58,7 @@ class Minz_Translate {
 
 	/**
 	 * Return the list of available languages.
-	 * @return an array containing langs found in different registered paths.
+	 * @return array containing langs found in different registered paths.
 	 */
 	public static function availableLanguages() {
 		$list_langs = array();
@@ -88,7 +88,7 @@ class Minz_Translate {
 	 * @param $user the connected user language (nullable)
 	 * @param $preferred an array of the preferred languages
 	 * @param $default the preferred language to use
-	 * @return a string containing the language to use
+	 * @return string containing the language to use
 	 */
 	public static function getLanguage($user, $preferred, $default) {
 		if (null !== $user) {
@@ -180,7 +180,7 @@ class Minz_Translate {
 	 * Translate a key into its corresponding value based on selected language.
 	 * @param $key the key to translate.
 	 * @param additional parameters for variable keys.
-	 * @return the value corresponding to the key.
+	 * @return string value corresponding to the key.
 	 *         If no value is found, return the key itself.
 	 */
 	public static function t($key) {

+ 4 - 4
lib/Minz/Url.php

@@ -12,7 +12,7 @@ class Minz_Url {
 	 *                    $url['params'] = tableau des paramètres supplémentaires
 	 *             ou comme une chaîne de caractère
 	 * @param $encodage pour indiquer comment encoder les & (& ou &amp; pour html)
-	 * @return l'url formatée
+	 * @return string url formatée
 	 */
 	public static function display ($url = array (), $encodage = 'html', $absolute = false) {
 		$isArray = is_array($url);
@@ -57,7 +57,7 @@ class Minz_Url {
 	 * Construit l'URI d'une URL
 	 * @param l'url sous forme de tableau
 	 * @param $encodage pour indiquer comment encoder les & (& ou &amp; pour html)
-	 * @return l'uri sous la forme ?key=value&key2=value2
+	 * @return string uri sous la forme ?key=value&key2=value2
 	 */
 	private static function printUri($url, $encodage) {
 		$uri = '';
@@ -95,8 +95,8 @@ class Minz_Url {
 
 	/**
 	 * Vérifie que les éléments du tableau représentant une url soit ok
-	 * @param l'url sous forme de tableau (sinon renverra directement $url)
-	 * @return l'url vérifié
+	 * @param array|string $url sous forme de tableau (sinon renverra directement $url)
+	 * @return string url vérifié
 	 */
 	public static function checkUrl ($url) {
 		$url_checked = $url;

+ 1 - 1
lib/Minz/View.php

@@ -77,7 +77,7 @@ class Minz_View {
 	 * The file is searched inside list of $base_pathnames.
 	 *
 	 * @param $filename the name of the file to include.
-	 * @return true if the file has been included, false else.
+	 * @return boolean true if the file has been included, false else.
 	 */
 	private function includeFile($filename) {
 		// We search the filename in the list of base pathnames. Only the first view

+ 4 - 4
lib/lib_rss.php

@@ -19,7 +19,7 @@ if (COPY_SYSLOG_TO_STDERR) {
  * Build a directory path by concatenating a list of directory names.
  *
  * @param $path_parts a list of directory names
- * @return a string corresponding to the final pathname
+ * @return string corresponding to the final pathname
  */
 function join_path() {
 	$path_parts = func_get_args();
@@ -333,7 +333,7 @@ function listUsers() {
  *
  * Note a max_regstrations of 0 means there is no limit.
  *
- * @return true if number of users >= max registrations, false else.
+ * @return boolean true if number of users >= max registrations, false else.
  */
 function max_registrations_reached() {
 	$limit_registrations = FreshRSS_Context::$system_conf->limits['max_registrations'];
@@ -350,7 +350,7 @@ function max_registrations_reached() {
  * objects. If you need a long-time configuration, please don't use this function.
  *
  * @param $username the name of the user of which we want the configuration.
- * @return a Minz_Configuration object, null if the configuration cannot be loaded.
+ * @return Minz_Configuration object, null if the configuration cannot be loaded.
  */
 function get_user_configuration($username) {
 	if (!FreshRSS_user_Controller::checkUsername($username)) {
@@ -499,7 +499,7 @@ function recursive_unlink($dir) {
  * Remove queries where $get is appearing.
  * @param $get the get attribute which should be removed.
  * @param $queries an array of queries.
- * @return the same array whithout those where $get is appearing.
+ * @return array whithout queries where $get is appearing.
  */
 function remove_query_by_get($get, $queries) {
 	$final_queries = array();