Merge "Inject LinkRendererFactory into Parser"
[lhc/web/wiklou.git] / languages / Language.php
index 9ed67f9..52cb231 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
@@ -3701,6 +3697,7 @@ class Language {
                                        }
                                } elseif ( $dispLen > $length && $dispLen > strlen( $ellipsis ) ) {
                                        # String in fact does need truncation, the truncation point was OK.
+                                       // @phan-suppress-next-line PhanTypeInvalidExpressionArrayDestructuring
                                        list( $ret, $openTags ) = $maybeState; // reload state
                                        $ret = $this->removeBadCharLast( $ret ); // multi-byte char fix
                                        $ret .= $ellipsis; // add ellipsis