Skip to content

Commit 270121b

Browse files
committed
Allow custom visibilities for inserting class properties and/or extracting class properties. Default value privated is keept.
1 parent 41e4a24 commit 270121b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugin/php-refactoring-toolbox.vim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ function! PhpExtractClassProperty() " {{{
181181
normal mr
182182
let l:name = expand('<cword>')
183183
call s:PhpReplaceInCurrentFunction('$' . l:name . '\>', '$this->' . l:name)
184-
call s:PhpInsertProperty(l:name, "private")
184+
let l:visibility = inputdialog("Visibility (default is private): ")
185+
if empty(l:visibility)
186+
let l:visibility = 'private'
187+
endif
188+
call s:PhpInsertProperty(l:name, l:visibility)
185189
normal `r
186190
endfunction
187191
" }}}
@@ -237,7 +241,11 @@ endfunction
237241

238242
function! PhpCreateProperty() " {{{
239243
let l:name = inputdialog("Name of new property: ")
240-
call s:PhpInsertProperty(l:name, "private")
244+
let l:visibility = inputdialog("Visibility (default is private): ")
245+
if empty(l:visibility)
246+
let l:visibility = 'private'
247+
endif
248+
call s:PhpInsertProperty(l:name, l:visibility)
241249
endfunction
242250
" }}}
243251

0 commit comments

Comments
 (0)