From 2063124b9cc2a66e1c741cf3a6cf1fde0139f7ce Mon Sep 17 00:00:00 2001 From: Nicolas Daniel Palumbo Date: Mon, 6 May 2019 23:19:10 +0200 Subject: [PATCH 1/2] Add PHP7 return types support - Force blank line before return docblock. - Allow space before return types. --- ftplugin/php_documentor.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ftplugin/php_documentor.vim b/ftplugin/php_documentor.vim index b659a1a..4f367b7 100644 --- a/ftplugin/php_documentor.vim +++ b/ftplugin/php_documentor.vim @@ -149,7 +149,8 @@ let g:pdv_re_abstract = '\(abstract\)' let g:pdv_re_final = '\(final\)' " [:space:]*(private|protected|public|static|abstract)*[:space:]+[:identifier:]+\([:params:]\) -let g:pdv_re_func = '^\s*\([a-zA-Z ]*\)function\s\+\([^ (]\+\)\s*(\s*\(.*\)\s*)\s*[{;]\?$' +let g:pdv_re_func = '^\s*\([a-zA-Z ]*\)function\s\+\([^ (]\+\)\s*(\s*\(.*\)\s*)\(\s*:\(.*\)\)\?\s*[{;]\?$' + " [:typehint:]*[:space:]*$[:identifier]\([:space:]*=[:space:]*[:value:]\)? let g:pdv_re_param = ' *\([^ &]*\) *&\?\$\([A-Za-z_][A-Za-z0-9_]*\) *=\? *\(.*\)\?$' @@ -291,6 +292,7 @@ func! PhpDocFunc() let l:modifier = substitute (l:name, g:pdv_re_func, '\1', "g") let l:funcname = substitute (l:name, g:pdv_re_func, '\2', "g") let l:parameters = substitute (l:name, g:pdv_re_func, '\3', "g") . "," + let l:returntype = substitute (l:name, g:pdv_re_func, '\5', "g") let l:scope = PhpDocScope(l:modifier, l:funcname) let l:static = g:pdv_cfg_php4always == 1 ? matchstr(l:modifier, g:pdv_re_static) : "" let l:abstract = g:pdv_cfg_php4always == 1 ? matchstr(l:modifier, g:pdv_re_abstract) : "" @@ -339,7 +341,12 @@ func! PhpDocFunc() if l:scope != "" call add(l:comment_lines, l:indent . g:pdv_cfg_Commentn . " @access " . l:scope) endif - call add(l:comment_lines, l:indent . g:pdv_cfg_Commentn . " @return " . g:pdv_cfg_ReturnVal) + " Default return type from config + if l:returntype == "" + let l:returntype = g:pdv_cfg_ReturnVal + endif + call add(l:comment_lines, l:indent . g:pdv_cfg_Commentn) + call add(l:comment_lines, l:indent . g:pdv_cfg_Commentn . " @return " . l:returntype) " Close the comment block. call add(l:comment_lines, l:indent . g:pdv_cfg_CommentTail) From 5c3e136a0a0e09a717b0f4540aae46d6636c9dd3 Mon Sep 17 00:00:00 2001 From: Nicolas Daniel Palumbo Date: Mon, 6 May 2019 23:21:51 +0200 Subject: [PATCH 2/2] Add gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8d9103 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tags +*.pyc