Skip to content

Commit a4af76a

Browse files
committed
Add support for tokens inside a 'if' statement
Fix #7
1 parent bcad0aa commit a4af76a

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

PHPCtags.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ private function struct($node, $reset=FALSE, $parent=array())
7979
foreach ($node as $subNode) {
8080
$this->struct($subNode, FALSE, array('method' => $name));
8181
}
82+
} elseif ($node instanceof PHPParser_Node_Stmt_If) {
83+
foreach ($node as $subNode) {
84+
$this->struct($subNode);
85+
}
8286
} elseif ($node instanceof PHPParser_Node_Stmt_Const) {
8387
$kind = 'd';
8488
$cons = $node->consts[0];
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+
}
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)