Skip to content

Commit 220a755

Browse files
committed
Merge branch 'feature/improved-tokens-support' into develop
2 parents b1afd7d + 26963ab commit 220a755

File tree

7 files changed

+73
-2
lines changed

7 files changed

+73
-2
lines changed

PHPCtags.class.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ private function struct($node, $reset=FALSE, $parent=array())
121121
foreach ($node as $subNode) {
122122
$this->struct($subNode, FALSE, array('method' => $name));
123123
}
124+
} elseif ($node instanceof PHPParser_Node_Stmt_If) {
125+
foreach ($node as $subNode) {
126+
$this->struct($subNode);
127+
}
124128
} elseif ($node instanceof PHPParser_Node_Stmt_Const) {
125129
$kind = 'd';
126130
$cons = $node->consts[0];
@@ -135,15 +139,17 @@ private function struct($node, $reset=FALSE, $parent=array())
135139
//@todo
136140
} elseif ($node instanceof PHPParser_Node_Stmt_Declare) {
137141
//@todo
142+
} elseif ($node instanceof PHPParser_Node_Stmt_TryCatch) {
143+
foreach ($node as $subNode) {
144+
$this->struct($subNode);
145+
}
138146
} elseif ($node instanceof PHPParser_Node_Stmt_Function) {
139147
$kind = 'f';
140148
$name = $node->name;
141149
$line = $node->getLine();
142150
foreach ($node as $subNode) {
143151
$this->struct($subNode, FALSE, array('function' => $name));
144152
}
145-
} elseif ($node instanceof PHPParser_Node_Stmt_Trait) {
146-
//@todo
147153
} elseif ($node instanceof PHPParser_Node_Stmt_Interface) {
148154
$kind = 'i';
149155
$name = $node->name;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
function e_0003_define()
3+
{
4+
return array(
5+
array(
6+
'name'=>'$ctags',
7+
'kind'=>'v',
8+
'line'=>'3',
9+
'scope'=>'',
10+
'access'=>'',
11+
),
12+
array(
13+
'name'=>'$result',
14+
'kind'=>'v',
15+
'line'=>'4',
16+
'scope'=>'',
17+
'access'=>'',
18+
),
19+
);
20+
}

tests/examples/0003.example.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
try {
3+
$ctags = new PHPCtags();
4+
$result = $ctags->export($file, $options);
5+
} catch (Exception $e) {
6+
die("phpctags: {$e->getMessage()}");
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
function e_bugfix_0007_define()
3+
{
4+
return array(
5+
array(
6+
'name'=>'MyClass',
7+
'kind'=>'c',
8+
'line'=>'3',
9+
'scope'=>'',
10+
'access'=>'',
11+
),
12+
);
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
if (!class_exists('MyClass')) {
3+
class MyClass {
4+
}
5+
}

tests/testcases/0003.testcase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
class t_0003 extends PHPCtagsTestCase {
3+
4+
public function __construct()
5+
{
6+
parent::__construct();
7+
$this->mExample = '0003';
8+
}
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
class t_bugfix_0007 extends PHPCtagsTestCase {
3+
4+
public function __construct()
5+
{
6+
parent::__construct();
7+
$this->mExample = 'bugfix_0007';
8+
}
9+
10+
}

0 commit comments

Comments
 (0)