From ec5681bd40673af2ba2c86db46a7e7f1751a99cd Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 20 Jun 2018 09:52:30 -0700 Subject: [PATCH] remove type hint --- lib/Telegraph/FindLinks.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Telegraph/FindLinks.php b/lib/Telegraph/FindLinks.php index a1d9e79..722835b 100644 --- a/lib/Telegraph/FindLinks.php +++ b/lib/Telegraph/FindLinks.php @@ -33,7 +33,8 @@ class FindLinks { * @param $input string text block * @return mixed array of links in text block. */ - public static function inText(\string $input) { + public static function inText($input) { + if(!is_string($input)) return []; preg_match_all('/https?:\/\/[^ ]+/', $input, $matches); return array_unique($matches[0]); } @@ -43,7 +44,9 @@ class FindLinks { * @param $input string text block * @return mixed array of links in text block. */ - public static function inHTML(\string $html) { + public static function inHTML($html) { + if(!is_string($input)) return []; + $doc = new DOMDocument(); libxml_use_internal_errors(true); # suppress parse errors and warnings @$doc->loadHTML(self::toHtmlEntities($html), LIBXML_NOWARNING|LIBXML_NOERROR);