Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17306

Wrong declaration of function input values

    XMLWordPrintable

Details

    Description

      In:
      The function: get_context() is described as:

      /**
      * Generates a text with approx. the specified length which contains the specified words and their context
      *
      * @param	string	$text	The full text from which context shall be extracted
      * @param	string	$words	An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
      * @param	int		$length	The desired length of the resulting text, however the result might be shorter or longer than this value
      *
      * @return	string			Context of the specified words separated by "..."
      */
      function get_context($text, $words, $length = 400)
      

      The $words is described as an array, but marked as an string in the doc-block.

      @param	string	$words	An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
      

      Should be changed to:

      @param	array $words	An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
      

      Maybe change the function input, too, to:

      function get_context(string $text, array $words, int $length = 400)
      

      Attachments

        Activity

          People

            Crizzo Crizzo
            Crizzo Crizzo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: