Skip to content

Commit f35ebc0

Browse files
committed
Merge branch 'Simounet-feature/getters-setters-auto-validation'
2 parents 41e4a24 + 544b881 commit f35ebc0

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
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_sg = 1
36+
```
37+
3238
## Default Mappings
3339

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

plugin/php-refactoring-toolbox.vim

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
" Maintainer: Pierrick Charron <pierrick@adoy.net>
55
" URL: https://github.com/adoy/vim-php-refactoring-toolbox
66
" License: MIT
7-
" Version: 1.0.2
7+
" Version: 1.0.3
88
"
99

1010
" Config {{{
@@ -16,6 +16,14 @@ 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
23+
24+
if !exists('g:vim_php_refactoring_auto_validate_sg')
25+
let g:vim_php_refactoring_auto_validate_sg = g:vim_php_refactoring_auto_validate
26+
endif
1927
" }}}
2028

2129
" Refactoring mapping {{{
@@ -91,9 +99,11 @@ function! PhpCreateSettersAndGetters() " {{{
9199
endwhile
92100
for l:property in l:properties
93101
let l:camelCaseName = substitute(l:property, '^_\?\(.\)', '\U\1', '')
94-
call s:PhpEchoError('Create set' . l:camelCaseName . '() and get' . l:camelCaseName . '()')
95-
if inputlist(["0. No", "1. Yes"]) == 0
96-
continue
102+
if g:vim_php_refactoring_auto_validate_sg == 0
103+
call s:PhpEchoError('Create set' . l:camelCaseName . '() and get' . l:camelCaseName . '()')
104+
if inputlist(["0. No", "1. Yes"]) == 0
105+
continue
106+
endif
97107
endif
98108
if search(s:php_regex_func_line . "set" . l:camelCaseName . '\>', 'n') == 0
99109
call s:PhpInsertMethod("public", "set" . l:camelCaseName, ['$' . substitute(l:property, '^_', '', '') ], "$this->" . l:property . " = $" . substitute(l:property, '^_', '', '') . ";\n")

0 commit comments

Comments
 (0)