Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9065a3c

Browse files
committed
Option to disable user validation of rename tools
1 parentf35ebc0 commit9065a3c

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

‎README.md‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ PHP Refactoring Toolbox for VIM
1515
* Create setters and getters
1616
* Document all code
1717

18-
##Installation
18+
##Installation
1919

2020
*[vim-plug](https://github.com/junegunn/vim-plug):`Plug 'adoy/vim-php-refactoring-toolbox'`
2121
*[vundle](https://github.com/gmarik/Vundle.vim):`Plugin 'adoy/vim-php-refactoring-toolbox'`
2222
*[pathogen](https://github.com/tpope/vim-pathogen):`git clone https://github.com/adoy/vim-php-refactoring-toolbox.git ~/.vim/bundle/`
2323
* or just copy the`plugin/php-refactoring-toolbox.vim` in your`~/.vim/plugin` folder
2424

2525

26-
If you want to disable the default mapping just add this line in your`~/.vimrc` file
26+
If you want to disable the default mapping just add this line in your`~/.vimrc` file
2727

2828
```
2929
let g:vim_php_refactoring_use_default_mapping = 0
@@ -35,6 +35,13 @@ If you want to disable the user validation at the getter/setter creation, just a
3535
let g:vim_php_refactoring_auto_validate_sg = 1
3636
```
3737

38+
If you want to disable the user validation for all rename features, just add this line in your`~/.vimrc` file
39+
40+
```
41+
let g:vim_php_refactoring_auto_validate_rename = 1
42+
```
43+
44+
3845
##Default Mappings
3946

4047
nnoremap <unique> <Leader>rlv :call PhpRenameLocalVariable()<CR>
@@ -180,8 +187,8 @@ class Dir {
180187

181188
class HelloWorld {
182189
public function sayHello($firstName = null) {
183-
$sentence = 'Hello';
184-
if ($firstName) {
190+
$sentence = 'Hello';
191+
if ($firstName) {
185192
$sentence .= ' ' . $firstName;
186193
}
187194
echo $sentence;
@@ -203,7 +210,7 @@ class HelloWorld {
203210

204211
private function prepareSentence($firstName)
205212
{
206-
$sentence = 'Hello';
213+
$sentence = 'Hello';
207214
if ($firstName) {
208215
$sentence .= ' ' . $firstName;
209216
}

‎plugin/php-refactoring-toolbox.vim‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ if !exists('g:vim_php_refactoring_auto_validate')
2222
endif
2323

2424
if!exists('g:vim_php_refactoring_auto_validate_sg')
25-
letg:vim_php_refactoring_auto_validate_sg=g:vim_php_refactoring_auto_validate
25+
letg: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+
letg:vim_php_refactoring_auto_validate_rename=g:vim_php_refactoring_auto_validate
2630
endif
2731
" }}}
2832

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp