For a long time I have used the famous PDV phpDocumentor. It’s great but it has some flaws and is not longer maintained (Latest commit on Dec 9, 2015
).
Meet php-doc-modded
Luckily there is php-doc-modded!
The plugin adds:
- support for php5.4+ array short syntax
- support for php7 return types
- option for enabling class docs or not
Update phpDoc function
I’ve written a litte function that that updates the phpDoc if it exists:
nnoremap <leader>h :call UpdatePhpDocIfExists()<CR>
function! UpdatePhpDocIfExists()
normal! k
if getline('.') =~ '/'
normal! V%d
else
normal! j
endif
call PhpDocSingle()
normal! k^%k$
if getline('.') =~ ';'
exe "normal! $svoid"
endif
endfunction
Todos
- if there is a
@return
annotation but no php7 return type hinting the existing one will be overriden with@return void
@throws
annotations are deleted