@@ -25,7 +25,7 @@ class Comment
25
25
* @param string $eolChar The EOL character to use for splitting strings.
26
26
* @param int $stackPtr The position of the first token in the file.
27
27
*
28
- * @return array
28
+ * @return array<int, array<string, string|int|array<int>>>
29
29
*/
30
30
public function tokenizeString ($ string , $ eolChar , $ stackPtr )
31
31
{
@@ -81,6 +81,7 @@ public function tokenizeString($string, $eolChar, $stackPtr)
81
81
];
82
82
83
83
if ($ closeTag ['content ' ] === false ) {
84
+ // In PHP < 8.0 substr() can return `false` instead of always returning a string.
84
85
$ closeTag ['content ' ] = '' ;
85
86
}
86
87
@@ -178,7 +179,7 @@ public function tokenizeString($string, $eolChar, $stackPtr)
178
179
* @param int $start The position in the string to start processing.
179
180
* @param int $end The position in the string to end processing.
180
181
*
181
- * @return array
182
+ * @return array<int, array<string, string|int>>
182
183
*/
183
184
private function processLine ($ string , $ eolChar , $ start , $ end )
184
185
{
@@ -253,7 +254,7 @@ private function processLine($string, $eolChar, $start, $end)
253
254
* @param int $start The position in the string to start processing.
254
255
* @param int $end The position in the string to end processing.
255
256
*
256
- * @return array|null
257
+ * @return array<string, string|int> |null
257
258
*/
258
259
private function collectWhitespace ($ string , $ start , $ end )
259
260
{
@@ -270,14 +271,12 @@ private function collectWhitespace($string, $start, $end)
270
271
return null ;
271
272
}
272
273
273
- $ token = [
274
+ return [
274
275
'content ' => $ space ,
275
276
'code ' => T_DOC_COMMENT_WHITESPACE ,
276
277
'type ' => 'T_DOC_COMMENT_WHITESPACE ' ,
277
278
];
278
279
279
- return $ token ;
280
-
281
280
}//end collectWhitespace()
282
281
283
282
0 commit comments