Merge "Language: Use type hint instead of manual type check"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 Apr 2019 20:21:22 +0000 (20:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 Apr 2019 20:21:22 +0000 (20:21 +0000)
languages/Language.php

index 9ed67f9..f72ac1a 100644 (file)
@@ -3556,12 +3556,8 @@ class Language {
         * @return string
         */
        private function truncateInternal(
-               $string, $length, $ellipsis, $adjustLength, $measureLength, $getSubstring
+               $string, $length, $ellipsis, $adjustLength, callable $measureLength, callable $getSubstring
        ) {
-               if ( !is_callable( $measureLength ) || !is_callable( $getSubstring ) ) {
-                       throw new InvalidArgumentException( 'Invalid callback provided' );
-               }
-
                # Check if there is no need to truncate
                if ( $measureLength( $string ) <= abs( $length ) ) {
                        return $string; // no need to truncate