Pastakhov has uploaded a new change for review.
https://gerrit.wikimedia.org/r/111786
Change subject: fix abstract static function BaseHooks::getClassName()
......................................................................
fix abstract static function BaseHooks::getClassName()
Change-Id: Id3e4c74b214822cc820ee7e42e4a7f7514e70a60
---
M PhpTags.php
M includes/BaseHooks.php
M includes/ExceptionPhpTags.php
3 files changed, 10 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PhpTags
refs/changes/86/111786/1
diff --git a/PhpTags.php b/PhpTags.php
index c59a945..0729468 100644
--- a/PhpTags.php
+++ b/PhpTags.php
@@ -17,7 +17,7 @@
define( 'PHPTAGS_MAJOR_VERSION', 1 );
define( 'PHPTAGS_MINOR_VERSION', 0 );
-define( 'PHPTAGS_RELEASE_VERSION', 4 );
+define( 'PHPTAGS_RELEASE_VERSION', 5 );
define( 'PHPTAGS_VERSION', PHPTAGS_MAJOR_VERSION . '.' . PHPTAGS_MINOR_VERSION
. '.' . PHPTAGS_RELEASE_VERSION );
// Register this extension on Special:Version
diff --git a/includes/BaseHooks.php b/includes/BaseHooks.php
index 1d298ff..bdfeffd 100644
--- a/includes/BaseHooks.php
+++ b/includes/BaseHooks.php
@@ -27,11 +27,13 @@
abstract class BaseHooks {
protected static $functions_definition = array();
- abstract static function getClassName();
+ protected static function getClassName() {
+ return get_called_class();
+ }
public static function onFunctionHook( $name, $params, &$transit ) {
if ( !isset(static::$functions_definition[$name]) ) {
- return new ExceptionPhpTags(
PHPTAGS_EXCEPTION_WARNING_INVALID_HOOK, array($name, static::getClassName()) );
+ throw new ExceptionPhpTags(
PHPTAGS_EXCEPTION_WARNING_INVALID_HOOK, array(static::getClassName(), $name) );
}
$definition = static::$functions_definition[$name];
$args = array();
@@ -49,7 +51,7 @@
if ( $definition[$d][PHPTAGS_HOOK_NEED_LINK] ) {
if ( $params[$i][PHPTAGS_STACK_COMMAND] !=
T_VARIABLE ) {
if (
$definition[$d][PHPTAGS_HOOK_NEED_LINK] === true ) {
- return new ExceptionPhpTags(
PHPTAGS_EXCEPTION_FATAL_VALUE_PASSED_BY_REFERENCE );
+ throw new ExceptionPhpTags(
PHPTAGS_EXCEPTION_FATAL_VALUE_PASSED_BY_REFERENCE );
} else {
$args[$i] =
$params[$i][PHPTAGS_STACK_RESULT];
}
@@ -66,7 +68,7 @@
}
$args[$i] =
&$args[$i][ $v[PHPTAGS_STACK_RESULT] ];
} else {
- return new
ExceptionPhpTags( PHPTAGS_EXCEPTION_FATAL_VALUE_PASSED_BY_REFERENCE );
+ throw new
ExceptionPhpTags( PHPTAGS_EXCEPTION_FATAL_VALUE_PASSED_BY_REFERENCE );
}
}
}
diff --git a/includes/ExceptionPhpTags.php b/includes/ExceptionPhpTags.php
index f40c980..7a9ad1b 100644
--- a/includes/ExceptionPhpTags.php
+++ b/includes/ExceptionPhpTags.php
@@ -140,7 +140,9 @@
case PHPTAGS_EXCEPTION_FATAL_INVALID_HOOK_CLASS:
$message = "For the function {$params[0]} was
registered invalid hook class {$params[1]}";
break;
-
+ case PHPTAGS_EXCEPTION_WARNING_INVALID_HOOK:
+ $message = "The hook '{$params[0]}' was
registered for the class '{$params[1]}', but one does not contain information
about how to handle it";
+ break;
case PHPTAGS_FATAL_CANNOT_UNSET_STRING_OFFSETS:
$message = 'PHP Fatal error: Cannot unset
string offsets';
break;
--
To view, visit https://gerrit.wikimedia.org/r/111786
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3e4c74b214822cc820ee7e42e4a7f7514e70a60
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PhpTags
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits