private function getClosingParenthesis(File $phpcs_file, array $tokens, $stack_ptr): int
    {
        $closing_parenthesis = $tokens[$stack_ptr]['parenthesis_closer'];

        // In case the function is a closure, the closing parenthesis
        // may be positioned after a use language construct.
        if ($tokens[$stack_ptr]['code'] === T_CLOSURE) {
            $use = $phpcs_file->findNext(T_USE, $closing_parenthesis + 1, $tokens[$stack_ptr]['scope_opener']);
            if ($use !== false) {
                $open_bracket        = $phpcs_file->findNext(T_OPEN_PARENTHESIS, $use + 1);
                $closing_parenthesis = $tokens[$open_bracket]['parenthesis_closer'];
            }
        }

        return $closing_parenthesis;
    }