Skip to content

Commit 41f2ef4

Browse files
committed
oldClassConstructors: handle abstract classes
1 parent 2ca8796 commit 41f2ef4

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('#^(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)