Skip to content

Commit 53f2fec

Browse files
committed
Add fluent setter
1 parent 435c0e0 commit 53f2fec

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class Foo {
268268
}
269269
```
270270

271-
Hit `<Leader>sg` and you'll be prompted if you want to create setters and getters for existing properties.
271+
Hit `<Leader>sg` and you'll be prompted if you want to create setters and getters for existing properties and if you want to make the setter fluent.
272272

273273
``` php
274274
<?php

doc/refactoring-toolbox.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
*refactoring-toolbox*
1+
*refactoring-toolbox*
22

3-
__________ _____ __ .__ ___________ .__ ___.
3+
__________ _____ __ .__ ___________ .__ ___.
44
\______ \ _____/ ____\____ _____/ |_ ___________|__| ____ ____ \__ ___/___ ____ | |\_ |__ _______ ___
55
| _// __ \ __\\__ \ _/ ___\ __\/ _ \_ __ \ |/ \ / ___\ | | / _ \ / _ \| | | __ \ / _ \ \/ /
6-
| | \ ___/| | / __ \\ \___| | ( <_> ) | \/ | | \/ /_/ > | |( <_> | <_> ) |_| \_\ ( <_> > <
6+
| | \ ___/| | / __ \\ \___| | ( <_> ) | \/ | | \/ /_/ > | |( <_> | <_> ) |_| \_\ ( <_> > <
77
|____|_ /\___ >__| (____ /\___ >__| \____/|__| |__|___| /\___ / |____| \____/ \____/|____/___ /\____/__/\_ \
88
\/ \/ \/ \/ \//_____/ \/ \/
99

@@ -229,7 +229,7 @@ class Foo {
229229
private $bar;
230230
}
231231

232-
Hit <Leader>sg and you'll be prompted if you want to create setters and getters for existing properties.
232+
Hit `<Leader>sg` and you'll be prompted if you want to create setters and getters for existing properties and if you want to make the setter fluent.
233233

234234
<?php
235235

plugin/php-refactoring-toolbox.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ function! PhpCreateSettersAndGetters() " {{{
128128
endif
129129
if search(s:php_regex_func_line . "set" . l:camelCaseName . '\>', 'n') == 0
130130
call s:PhpInsertMethod("public", "set" . l:camelCaseName, ['$' . substitute(l:property, '^_', '', '') ], "$this->" . l:property . " = $" . substitute(l:property, '^_', '', '') . ";\n")
131+
call s:PhpEchoError('Make fluent?')
132+
if inputlist(["0. No", "1. Yes"]) == 1
133+
exec "normal! jo\<CR>return $this;"
134+
endif
131135
endif
132136
if search(s:php_regex_func_line . "get" . l:camelCaseName . '\>', 'n') == 0
133137
call s:PhpInsertMethod("public", "get" . l:camelCaseName, [], "return $this->" . l:property . ";\n")

0 commit comments

Comments
 (0)