diff --git a/src/Files/File.php b/src/Files/File.php index 8d1f1a8416..d3c799d2ca 100644 --- a/src/Files/File.php +++ b/src/Files/File.php @@ -1538,17 +1538,19 @@ public function getMethodParameters($stackPtr) * The format of the return value is: * * array( - * 'scope' => 'public', // Public, private, or protected - * 'scope_specified' => true, // TRUE if the scope keyword was found. - * 'return_type' => '', // The return type of the method. - * 'return_type_token' => integer, // The stack pointer to the start of the return type - * // or FALSE if there is no return type. - * 'nullable_return_type' => false, // TRUE if the return type is preceded by the - * // nullability operator. - * 'is_abstract' => false, // TRUE if the abstract keyword was found. - * 'is_final' => false, // TRUE if the final keyword was found. - * 'is_static' => false, // TRUE if the static keyword was found. - * 'has_body' => false, // TRUE if the method has a body + * 'scope' => 'public', // Public, private, or protected + * 'scope_specified' => true, // TRUE if the scope keyword was found. + * 'return_type' => '', // The return type of the method. + * 'return_type_token' => integer, // The stack pointer to the start of the return type + * // or FALSE if there is no return type. + * 'return_type_end_token' => integer, // The stack pointer to the end of the return type + * // or FALSE if there is no return type. + * 'nullable_return_type' => false, // TRUE if the return type is preceded by the + * // nullability operator. + * 'is_abstract' => false, // TRUE if the abstract keyword was found. + * 'is_final' => false, // TRUE if the final keyword was found. + * 'is_static' => false, // TRUE if the static keyword was found. + * 'has_body' => false, // TRUE if the method has a body * ); * * @@ -1627,6 +1629,7 @@ public function getMethodProperties($stackPtr) $returnType = ''; $returnTypeToken = false; + $returnTypeEndToken = false; $nullableReturnType = false; $hasBody = true; @@ -1666,9 +1669,10 @@ public function getMethodProperties($stackPtr) $returnTypeToken = $i; } - $returnType .= $this->tokens[$i]['content']; + $returnType .= $this->tokens[$i]['content']; + $returnTypeEndToken = $i; } - } + }//end for if ($this->tokens[$stackPtr]['code'] === T_FN) { $bodyToken = T_FN_ARROW; @@ -1685,15 +1689,16 @@ public function getMethodProperties($stackPtr) } return [ - 'scope' => $scope, - 'scope_specified' => $scopeSpecified, - 'return_type' => $returnType, - 'return_type_token' => $returnTypeToken, - 'nullable_return_type' => $nullableReturnType, - 'is_abstract' => $isAbstract, - 'is_final' => $isFinal, - 'is_static' => $isStatic, - 'has_body' => $hasBody, + 'scope' => $scope, + 'scope_specified' => $scopeSpecified, + 'return_type' => $returnType, + 'return_type_token' => $returnTypeToken, + 'return_type_end_token' => $returnTypeEndToken, + 'nullable_return_type' => $nullableReturnType, + 'is_abstract' => $isAbstract, + 'is_final' => $isFinal, + 'is_static' => $isStatic, + 'has_body' => $hasBody, ]; }//end getMethodProperties()