Skip to content

Commit 90d72a7

Browse files
author
Simon Alberny
committed
Option to disable the user validation of getters/setters creation
Just put this on your ~/.vimrc file: let g:vim_php_refactoring_auto_validate = 1
1 parent 41e4a24 commit 90d72a7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ If you want to disable the default mapping just add this line in your `~/.vimrc`
2929
let g:vim_php_refactoring_use_default_mapping = 0
3030
```
3131

32+
If you want to disable the user validation at the getter/setter creation, just add this line in your `~/.vimrc` file
33+
34+
```
35+
let g:vim_php_refactoring_auto_validate = 1
36+
```
37+
3238
## Default Mappings
3339

3440
nnoremap <unique> <Leader>rlv :call PhpRenameLocalVariable()<CR>

plugin/php-refactoring-toolbox.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ endif
1616
if !exists('g:vim_php_refactoring_use_default_mapping')
1717
let g:vim_php_refactoring_use_default_mapping = 1
1818
endif
19+
20+
if !exists('g:vim_php_refactoring_auto_validate')
21+
let g:vim_php_refactoring_auto_validate = 0
22+
endif
1923
" }}}
2024

2125
" Refactoring mapping {{{
@@ -92,8 +96,10 @@ function! PhpCreateSettersAndGetters() " {{{
9296
for l:property in l:properties
9397
let l:camelCaseName = substitute(l:property, '^_\?\(.\)', '\U\1', '')
9498
call s:PhpEchoError('Create set' . l:camelCaseName . '() and get' . l:camelCaseName . '()')
95-
if inputlist(["0. No", "1. Yes"]) == 0
96-
continue
99+
if g:vim_php_refactoring_auto_validate == 0
100+
if inputlist(["0. No", "1. Yes"]) == 0
101+
continue
102+
endif
97103
endif
98104
if search(s:php_regex_func_line . "set" . l:camelCaseName . '\>', 'n') == 0
99105
call s:PhpInsertMethod("public", "set" . l:camelCaseName, ['$' . substitute(l:property, '^_', '', '') ], "$this->" . l:property . " = $" . substitute(l:property, '^_', '', '') . ";\n")

0 commit comments

Comments
 (0)