Explorar el Código

phpdoc improvements, fixes #1036

El RIDO hace 2 años
padre
commit
5f00587d71
Se han modificado 5 ficheros con 6 adiciones y 12 borrados
  1. 0 1
      lib/Data/Database.php
  2. 0 1
      lib/Data/Filesystem.php
  3. 0 1
      lib/Data/GoogleCloudStorage.php
  4. 0 1
      lib/Data/S3Storage.php
  5. 6 8
      lib/I18n.php

+ 0 - 1
lib/Data/Database.php

@@ -55,7 +55,6 @@ class Database extends AbstractData
      * @access public
      * @access public
      * @param  array $options
      * @param  array $options
      * @throws Exception
      * @throws Exception
-     * @return
      */
      */
     public function __construct(array $options)
     public function __construct(array $options)
     {
     {

+ 0 - 1
lib/Data/Filesystem.php

@@ -66,7 +66,6 @@ class Filesystem extends AbstractData
      *
      *
      * @access public
      * @access public
      * @param  array $options
      * @param  array $options
-     * @return
      */
      */
     public function __construct(array $options)
     public function __construct(array $options)
     {
     {

+ 0 - 1
lib/Data/GoogleCloudStorage.php

@@ -47,7 +47,6 @@ class GoogleCloudStorage extends AbstractData
      *
      *
      * @access public
      * @access public
      * @param array $options
      * @param array $options
-     * @return
      */
      */
     public function __construct(array $options)
     public function __construct(array $options)
     {
     {

+ 0 - 1
lib/Data/S3Storage.php

@@ -78,7 +78,6 @@ class S3Storage extends AbstractData
      *
      *
      * @access public
      * @access public
      * @param array $options
      * @param array $options
-     * @return
      */
      */
     public function __construct(array $options)
     public function __construct(array $options)
     {
     {

+ 6 - 8
lib/I18n.php

@@ -85,7 +85,7 @@ class I18n
      * @param  mixed $args one or multiple parameters injected into placeholders
      * @param  mixed $args one or multiple parameters injected into placeholders
      * @return string
      * @return string
      */
      */
-    public static function _($messageId)
+    public static function _($messageId, ...$args)
     {
     {
         return forward_static_call_array('PrivateBin\I18n::translate', func_get_args());
         return forward_static_call_array('PrivateBin\I18n::translate', func_get_args());
     }
     }
@@ -99,7 +99,7 @@ class I18n
      * @param  mixed $args one or multiple parameters injected into placeholders
      * @param  mixed $args one or multiple parameters injected into placeholders
      * @return string
      * @return string
      */
      */
-    public static function translate($messageId)
+    public static function translate($messageId, ...$args)
     {
     {
         if (empty($messageId)) {
         if (empty($messageId)) {
             return $messageId;
             return $messageId;
@@ -114,7 +114,7 @@ class I18n
         if (!array_key_exists($messageId, self::$_translations)) {
         if (!array_key_exists($messageId, self::$_translations)) {
             self::$_translations[$messageId] = $messages;
             self::$_translations[$messageId] = $messages;
         }
         }
-        $args = func_get_args();
+        array_unshift($args, $messageId);
         if (is_array(self::$_translations[$messageId])) {
         if (is_array(self::$_translations[$messageId])) {
             $number = (int) $args[1];
             $number = (int) $args[1];
             $key    = self::_getPluralForm($number);
             $key    = self::_getPluralForm($number);
@@ -130,11 +130,9 @@ class I18n
         }
         }
         // encode any non-integer arguments and the message ID, if it doesn't contain a link
         // encode any non-integer arguments and the message ID, if it doesn't contain a link
         $argsCount = count($args);
         $argsCount = count($args);
-        if ($argsCount > 1) {
-            for ($i = 0; $i < $argsCount; ++$i) {
-                if (($i > 0 && !is_int($args[$i])) || strpos($args[0], '<a') === false) {
-                    $args[$i] = self::encode($args[$i]);
-                }
+        for ($i = 0; $i < $argsCount; ++$i) {
+            if ($i > 0 ? !is_int($args[$i]) : strpos($args[0], '<a') === false) {
+                $args[$i] = self::encode($args[$i]);
             }
             }
         }
         }
         return call_user_func_array('sprintf', $args);
         return call_user_func_array('sprintf', $args);