]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/utils/string/class_StringUtils.php
Continued:
[core.git] / framework / main / classes / utils / string / class_StringUtils.php
index e6c4c738cfc6364d98b297e3cf875ab14d075e39..b114566a8a58b4db2f66bce7b67f449bdfd689f9 100644 (file)
@@ -144,17 +144,11 @@ final class StringUtils extends BaseFrameworkSystem {
         * @throws      NullPointerException    If $str is null
         * @throws      InvalidArgumentException        If $str is empty
         */
-       public static function convertDashesToUnderscores ($str) {
-               // Is it null?
-               if (is_null($str)) {
-                       // Throw NPE
-                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_string($str)) {
+       public static function convertDashesToUnderscores (string $str) {
+               // Validate parameter
+               if (empty($str)) {
                        // Entry is empty
-                       throw new InvalidArgumentException(sprintf('str[]=%s is not a string', gettype($str)), FrameworkConfiguration::EXCEPTION_CONFIG_KEY_IS_EMPTY);
-               } elseif ((is_string($str)) && (empty($str))) {
-                       // Entry is empty
-                       throw new InvalidArgumentException('str is empty', FrameworkConfiguration::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+                       throw new InvalidArgumentException('Parameter "str" is empty');
                }
 
                // Convert them all