Skip to content

Commit

Permalink
feat: Revert .\+ to .\{-} for php
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Jun 4, 2019
1 parent a80c3b6 commit aa0a5b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ftplugin/php.vim
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ call add(b:doge_patterns, {
" $arg5 = NULL
" ) {}
call add(b:doge_patterns, {
\ 'match': '\m^\%(\%(public\|private\|protected\)\s\+\)\?\%(\%(static\)\s\+\)\?\%(\%(final\)\s\+\)\?function\s*\([^(]\+\)\s*(\(.\+\))\s*{',
\ 'match': '\m^\%(\%(public\|private\|protected\)\s\+\)\?\%(\%(static\)\s\+\)\?\%(\%(final\)\s\+\)\?function\s*\([^(]\+\)\s*(\(.\{-}\))\s*{',
\ 'match_group_names': ['funcName', 'parameters'],
\ 'parameters': {
\ 'match': '\m\%(\([[:alnum:]_\\]\+\)\s\+\)\?&\?\($[[:alnum:]_]\+\)\%(\s*=\s*[^,]\+\)\?',
Expand Down
16 changes: 10 additions & 6 deletions test/languages/php/class-methods.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ Do (trigger doge):
:3\<CR>
\<C-d>

Expect php (no changes):
Expect php (class method with nothing but the text 'TODO'):
class Test {

/**
* TODO
*
*/
public function myMethod() {}

}
Expand All @@ -35,7 +39,7 @@ Do (trigger doge):
:3\<CR>
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
class Test {

/**
Expand All @@ -59,7 +63,7 @@ Do (trigger doge):
:3\<CR>
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
class Test {

/**
Expand All @@ -83,7 +87,7 @@ Do (trigger doge):
:3\<CR>
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
class Test {

/**
Expand All @@ -107,7 +111,7 @@ Do (trigger doge):
:3\<CR>
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
class Test {

/**
Expand Down Expand Up @@ -136,7 +140,7 @@ Do (trigger doge):
:5\<CR>
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class Test {
Expand Down
8 changes: 6 additions & 2 deletions test/languages/php/functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ Given php (function without parameters):
Do (trigger doge):
\<C-d>

Expect php (no changes):
Expect php (function with nothing but the text 'TODO'):
/**
* TODO
*
*/
function myFunc() {}

# ==============================================================================
Expand All @@ -19,7 +23,7 @@ Given php (function with parameters):
Do (trigger doge):
\<C-d>

Expect php (generated comment with param tags):
Expect php (generated comment with @param tags):
/**
* TODO
*
Expand Down

0 comments on commit aa0a5b1

Please sign in to comment.