mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 13:17:58 +02:00
Strict: added support for the old way of adding extension methods [Closes #195]
This commit is contained in:
@@ -116,6 +116,19 @@ trait Strict
|
|||||||
list($class, $name) = explode('::', $name);
|
list($class, $name) = explode('::', $name);
|
||||||
$class = (new ReflectionClass($class))->getName();
|
$class = (new ReflectionClass($class))->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self::$extMethods === NULL) { // for backwards compatibility
|
||||||
|
$list = get_defined_functions();
|
||||||
|
foreach ($list['user'] as $fce) {
|
||||||
|
$pair = explode('_prototype_', $fce);
|
||||||
|
if (count($pair) === 2) {
|
||||||
|
trigger_error("Extension method defined as $fce() is deprecated, use $class::extensionMethod('$name', ...).", E_USER_DEPRECATED);
|
||||||
|
self::$extMethods[$pair[1]][(new ReflectionClass($pair[0]))->getName()] = $fce;
|
||||||
|
self::$extMethods[$pair[1]][''] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$list = & self::$extMethods[strtolower($name)];
|
$list = & self::$extMethods[strtolower($name)];
|
||||||
if ($callback === NULL) { // getter
|
if ($callback === NULL) { // getter
|
||||||
$cache = & $list[''][$class];
|
$cache = & $list[''][$class];
|
||||||
|
Reference in New Issue
Block a user