Skip to content

Commit

Permalink
Merge pull request #35 from storyn26383/master
Browse files Browse the repository at this point in the history
Use class without namespace
  • Loading branch information
arnaud-lb committed Dec 6, 2017
2 parents ebe5620 + c5e41c7 commit 9a68e6a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/phpns.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function! PhpFindFqn(name)
let ns = strpart(getline(line('.')), start, end-start)
return ['class', ns . "\\" . a:name]
else
return a:name
return ['class', a:name]
endif
elseif search('^\s*function\_s\+' . a:name . '\>') > 0
if search('^\%(<?\%(php\s\+\)\?\)\?\s*namespace\s\+', 'be') > 0
Expand Down
5 changes: 5 additions & 0 deletions tests/test-class-without-ns.fixtures/a.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

class Foo {
}

7 changes: 7 additions & 0 deletions tests/test-class-without-ns.fixtures/tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
Foo test-class-without-ns.fixtures/a.php /^class Foo {$/;" c
12 changes: 12 additions & 0 deletions tests/test-class-without-ns.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

Basic test 1

STARTTEST
:%d
a<?php

class Foo:call PhpInsertUse()
ax:w! test.out
:qa!
ENDTEST

5 changes: 5 additions & 0 deletions tests/test-class-without-ns.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

use Foo;

class Foox

0 comments on commit 9a68e6a

Please sign in to comment.