@@ -22,7 +22,11 @@ if !exists('g:vim_php_refactoring_auto_validate')
2222endif
2323
2424if ! exists (' g:vim_php_refactoring_auto_validate_sg' )
25- let g: vim_php_refactoring_auto_validate_sg = g: vim_php_refactoring_auto_validate
25+ let g: vim_php_refactoring_auto_validate_sg = g: vim_php_refactoring_auto_validate
26+ endif
27+
28+ if ! exists (' g:vim_php_refactoring_auto_validate_rename' )
29+ let g: vim_php_refactoring_auto_validate_rename = g: vim_php_refactoring_auto_validate
2630endif
2731" }}}
2832
@@ -100,7 +104,7 @@ function! PhpCreateSettersAndGetters() " {{{
100104 for l: property in l: properties
101105 let l: camelCaseName = substitute (l: property , ' ^_\?\(.\)' , ' \U\1' , ' ' )
102106 if g: vim_php_refactoring_auto_validate_sg == 0
103- call s: PhpEchoError (' Create set' . l: camelCaseName . ' () and get' . l: camelCaseName . ' ()' )
107+ call s: PhpEchoError (' Create set' . l: camelCaseName . ' () and get' . l: camelCaseName . ' ()' )
104108 if inputlist ([" 0. No" , " 1. Yes" ]) == 0
105109 continue
106110 endif
@@ -119,9 +123,11 @@ function! PhpRenameLocalVariable() " {{{
119123 let l: oldName = substitute (expand (' <cword>' ), ' ^\$*' , ' ' , ' ' )
120124 let l: newName = inputdialog (' Rename ' . l: oldName . ' to: ' )
121125 if s: PhpSearchInCurrentFunction (' $' . l: newName . ' \>' , ' n' ) > 0
122- call s: PhpEchoError (' $' . l: newName . ' seems to already exist in the current function scope. Replace anyway ?' )
123- if inputlist ([" 0. No" , " 1. Yes" ]) == 0
124- return
126+ if g: vim_php_refactoring_auto_validate_rename == 0
127+ call s: PhpEchoError (' $' . l: newName . ' seems to already exist in the current function scope. Rename anyway ?' )
128+ if inputlist ([" 0. No" , " 1. Yes" ]) == 0
129+ return
130+ endif
125131 endif
126132 endif
127133 call s: PhpReplaceInCurrentFunction (' $' . l: oldName . ' \>' , ' $' . l: newName )
@@ -132,9 +138,11 @@ function! PhpRenameClassVariable() " {{{
132138 let l: oldName = expand (' <cword>' )
133139 let l: newName = inputdialog (' Rename ' . l: oldName . ' to: ' )
134140 if s: PhpSearchInCurrentClass (' \%(\%(\%(public\|protected\|private\|static\)\_s\+\)\+\$\|$this->\)\@<=' . l: newName . ' \>' , ' n' ) > 0
135- call s: PhpEchoError (l: newName . ' seems to already exist in the current class. Replace anyway ?' )
136- if inputlist ([" 0. No" , " 1. Yes" ]) == 0
137- return
141+ if g: vim_php_refactoring_auto_validate_rename == 0
142+ call s: PhpEchoError (l: newName . ' seems to already exist in the current class. Rename anyway ?' )
143+ if inputlist ([" 0. No" , " 1. Yes" ]) == 0
144+ return
145+ endif
138146 endif
139147 endif
140148 call s: PhpReplaceInCurrentClass (' \%(\%(\%(public\|protected\|private\|static\)\_s\+\)\+\$\|$this->\)\@<=' . l: oldName . ' \>' , l: newName )
@@ -145,9 +153,11 @@ function! PhpRenameMethod() " {{{
145153 let l: oldName = expand (' <cword>' )
146154 let l: newName = inputdialog (' Rename ' . l: oldName . ' to: ' )
147155 if s: PhpSearchInCurrentClass (' \%(\%(' . s: php_regex_func_line . ' \)\|$this->\)\@<=' . l: newName . ' \>' , ' n' ) > 0
148- call s: PhpEchoError (l: newName . ' seems to already exist in the current class. Replace anyway ?' )
149- if inputlist ([" 0. No" , " 1. Yes" ]) == 0
150- return
156+ if g: vim_php_refactoring_auto_validate_rename == 0
157+ call s: PhpEchoError (l: newName . ' seems to already exist in the current class. Rename anyway ?' )
158+ if inputlist ([" 0. No" , " 1. Yes" ]) == 0
159+ return
160+ endif
151161 endif
152162 endif
153163 call s: PhpReplaceInCurrentClass (' \%(\%(' . s: php_regex_func_line . ' \)\|$this->\)\@<=' . l: oldName . ' \>' , l: newName )
0 commit comments