[ticket/17306] Add type declaration to get_context and array for $words

PHPBB3-17306
This commit is contained in:
Christian Schnegelberger 2024-04-20 19:06:18 +02:00 committed by Marc Alexander
parent c219abf726
commit 8f1a777c5f
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -324,7 +324,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
* *
* @return string Context of the specified words separated by "..." * @return string Context of the specified words separated by "..."
*/ */
function get_context($text, $words, $length = 400) function get_context(string $text, array $words, int $length = 400)
{ {
// first replace all whitespaces with single spaces // first replace all whitespaces with single spaces
$text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' '));