Hook classes: Add class suffix if not exist

refs #7066
refs #7067
refs #7068
This commit is contained in:
Marius Hein 2014-09-04 12:15:24 +02:00
parent eeed030bb5
commit 4fb47ef768
1 changed files with 6 additions and 1 deletions

View File

@ -123,7 +123,12 @@ class Hook
*/
private static function assertValidHook($instance, $name)
{
$base_class = self::$BASE_NS . ucfirst($name) . self::$classSuffix;
$base_class = self::$BASE_NS . ucfirst($name);
if (strpos($base_class, self::$classSuffix) === false) {
$base_class .= self::$classSuffix;
}
if (!$instance instanceof $base_class) {
throw new ProgrammingError(
'%s is not an instance of %s',