@@ -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() " {{{
100104for l: propertyin l: properties
101105let l: camelCaseName= substitute (l: property ,' ^_\?\(.\)' ,' \U\1' ,' ' )
102106if 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 .' ()' )
104108if inputlist ([" 0. No" ," 1. Yes" ])== 0
105109continue
106110endif
@@ -119,9 +123,11 @@ function! PhpRenameLocalVariable() " {{{
119123let l: oldName= substitute (expand (' <cword>' ),' ^\$*' ,' ' ,' ' )
120124let l: newName= inputdialog (' Rename' .l: oldName .' to:' )
121125if 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
125131endif
126132endif
127133call s: PhpReplaceInCurrentFunction (' $' .l: oldName .' \>' ,' $' .l: newName )
@@ -132,9 +138,11 @@ function! PhpRenameClassVariable() " {{{
132138let l: oldName= expand (' <cword>' )
133139let l: newName= inputdialog (' Rename' .l: oldName .' to:' )
134140if 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
138146endif
139147endif
140148call s: PhpReplaceInCurrentClass (' \%(\%(\%(public\|protected\|private\|static\)\_s\+\)\+\$\|$this->\)\@<=' .l: oldName .' \>' ,l: newName )
@@ -145,9 +153,11 @@ function! PhpRenameMethod() " {{{
145153let l: oldName= expand (' <cword>' )
146154let l: newName= inputdialog (' Rename' .l: oldName .' to:' )
147155if 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
151161endif
152162endif
153163call s: PhpReplaceInCurrentClass (' \%(\%(' .s: php_regex_func_line .' \)\|$this->\)\@<=' .l: oldName .' \>' ,l: newName )