Skip to content

Commit 7f6cf63

Browse files
committed
Merge pull request Alexia#20 from macbre/oldClassConstructors-for-abstract-classes
oldClassConstructors: handle abstract classes
2 parents ddbc543 + c89242c commit 7f6cf63

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

classes/tests/critical.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,8 @@ public function _oldClassConstructors($line) {
144144
}
145145

146146
// find the start of PHP class declaration
147-
if (strpos($line, 'class') === 0) {
148-
if (preg_match('#class (\w+)#', $line, $matches)) {
149-
$lastClassName = $matches[1];
150-
}
147+
if (preg_match('#^\s?(abstract\s+)?class (\w+)#', $line, $matches)) {
148+
$lastClassName = $matches[2];
151149
}
152150

153151
// is the class name used as the function name?

testcases.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,8 @@ function FooBar()
153153
// NOP
154154
}
155155
}
156+
157+
abstract class TheThing {
158+
public function TheThing() {
159+
}
160+
}

0 commit comments

Comments
 (0)