diff --git a/src/Tokenizers/Comment.php b/src/Tokenizers/Comment.php index 523ce9e41a..b7c6e3745e 100644 --- a/src/Tokenizers/Comment.php +++ b/src/Tokenizers/Comment.php @@ -25,7 +25,7 @@ class Comment * @param string $eolChar The EOL character to use for splitting strings. * @param int $stackPtr The position of the first token in the file. * - * @return array + * @return array>> */ public function tokenizeString($string, $eolChar, $stackPtr) { @@ -81,6 +81,7 @@ public function tokenizeString($string, $eolChar, $stackPtr) ]; if ($closeTag['content'] === false) { + // In PHP < 8.0 substr() can return `false` instead of always returning a string. $closeTag['content'] = ''; } @@ -178,7 +179,7 @@ public function tokenizeString($string, $eolChar, $stackPtr) * @param int $start The position in the string to start processing. * @param int $end The position in the string to end processing. * - * @return array + * @return array> */ private function processLine($string, $eolChar, $start, $end) { @@ -253,7 +254,7 @@ private function processLine($string, $eolChar, $start, $end) * @param int $start The position in the string to start processing. * @param int $end The position in the string to end processing. * - * @return array|null + * @return array|null */ private function collectWhitespace($string, $start, $end) { @@ -270,14 +271,12 @@ private function collectWhitespace($string, $start, $end) return null; } - $token = [ + return [ 'content' => $space, 'code' => T_DOC_COMMENT_WHITESPACE, 'type' => 'T_DOC_COMMENT_WHITESPACE', ]; - return $token; - }//end collectWhitespace()