Skip to content

Commit a8ccfae

Browse files
committed
Merge branch 'feature/github-pull-18' into develop
2 parents 15c13f9 + 3775941 commit a8ccfae

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

PHPCtags.class.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ private function struct($node, $reset=FALSE, $parent=array())
112112
$structs = array();
113113
}
114114

115-
$kind = $name = $line = $access = '';
115+
$kind = $name = $line = $access = $extends = '';
116+
$implements = array();
116117

117118
if (!empty($parent)) array_push($scope, $parent);
118119

@@ -123,6 +124,8 @@ private function struct($node, $reset=FALSE, $parent=array())
123124
} elseif ($node instanceof PHPParser_Node_Stmt_Class) {
124125
$kind = 'c';
125126
$name = $node->name;
127+
$extends = $node->extends;
128+
$implements = $node->implements;
126129
$line = $node->getLine();
127130
foreach ($node as $subNode) {
128131
$this->struct($subNode, FALSE, array('class' => $name));
@@ -221,6 +224,8 @@ private function struct($node, $reset=FALSE, $parent=array())
221224
'file' => $this->mFile,
222225
'kind' => $kind,
223226
'name' => $name,
227+
'extends' => $extends,
228+
'implements' => $implements,
224229
'line' => $line,
225230
'scope' => $scope,
226231
'access' => $access,
@@ -321,6 +326,21 @@ private function render()
321326
$str .= "\t" . $s_str;
322327
}
323328

329+
#field=i
330+
if(in_array('i', $this->mOptions['fields'])) {
331+
$inherits = array();
332+
if(!empty($struct['extends'])) {
333+
$inherits[] = $struct['extends']->toString();
334+
}
335+
if(!empty($struct['implements'])) {
336+
foreach($struct['implements'] as $interface) {
337+
$inherits[] = $interface->toString();
338+
}
339+
}
340+
if(!empty($inherits))
341+
$str .= "\t" . 'inherits:' . implode(',', $inherits);
342+
}
343+
324344
#field=a
325345
if (in_array('a', $this->mOptions['fields']) && !empty($struct['access'])) {
326346
$str .= "\t" . "access:" . $struct['access'];

bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
if (!isset($options['memory']))
143143
$options['memory'] = '128M';
144144
if (!isset($options['fields'])) {
145-
$options['fields'] = array('n', 'k', 's', 'a');
145+
$options['fields'] = array('n', 'k', 's', 'a','i');
146146
} else {
147147
$options['fields'] = str_split($options['fields']);
148148
}

0 commit comments

Comments
 (0)