Skip to content

Commit 72ac846

Browse files
committed
Merge pull request #12 from adoy/bug-11
FIX #11 (Extract Class Property Goes Wrong).
2 parents 740a10d + 162bd0d commit 72ac846

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugin/php-refactoring-toolbox.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ endif
4646
if g:vim_php_refactoring_use_default_mapping == 1
4747
nnoremap <unique> <Leader>rlv :call PhpRenameLocalVariable()<CR>
4848
nnoremap <unique> <Leader>rcv :call PhpRenameClassVariable()<CR>
49-
nnoremap <unique> <Leader>rm :call PhpRenameMethod()<CR>
5049
nnoremap <unique> <Leader>eu :call PhpExtractUse()<CR>
50+
nnoremap <unique> <Leader>rm :call PhpRenameMethod()<CR>
5151
vnoremap <unique> <Leader>ec :call PhpExtractConst()<CR>
5252
nnoremap <unique> <Leader>ep :call PhpExtractClassProperty()<CR>
5353
vnoremap <unique> <Leader>em :call PhpExtractMethod()<CR>
@@ -147,7 +147,7 @@ endfunction
147147
" }}}
148148

149149
function! PhpRenameClassVariable() " {{{
150-
let l:oldName = expand('<cword>')
150+
let l:oldName = substitute(expand('<cword>'), '^\$*', '', '')
151151
let l:newName = inputdialog('Rename ' . l:oldName . ' to: ')
152152
if s:PhpSearchInCurrentClass('\%(\%(\%(public\|protected\|private\|static\)\_s\+\)\+\$\|$this->\)\@<=' . l:newName . '\>', 'n') > 0
153153
if g:vim_php_refactoring_auto_validate_rename == 0
@@ -162,7 +162,7 @@ endfunction
162162
" }}}
163163

164164
function! PhpRenameMethod() " {{{
165-
let l:oldName = expand('<cword>')
165+
let l:oldName = substitute(expand('<cword>'), '^\$*', '', '')
166166
let l:newName = inputdialog('Rename ' . l:oldName . ' to: ')
167167
if s:PhpSearchInCurrentClass('\%(\%(' . s:php_regex_func_line . '\)\|$this->\)\@<=' . l:newName . '\>', 'n') > 0
168168
if g:vim_php_refactoring_auto_validate_rename == 0
@@ -211,7 +211,7 @@ endfunction
211211

212212
function! PhpExtractClassProperty() " {{{
213213
normal mr
214-
let l:name = expand('<cword>')
214+
let l:name = substitute(expand('<cword>'), '^\$*', '', '')
215215
call s:PhpReplaceInCurrentFunction('$' . l:name . '\>', '$this->' . l:name)
216216
if g:vim_php_refactoring_auto_validate_visibility == 0
217217
let l:visibility = inputdialog("Visibility (default is " . g:vim_php_refactoring_default_property_visibility . "): ")

0 commit comments

Comments
 (0)