Skip to content

Commit

Permalink
MDL-59362 core: ensure we use 'new' when throwing exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Jun 26, 2017
1 parent f4a2d69 commit 6d721ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/classes/plugin_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static function reset_caches($phpunitreset = false) {
public function get_plugin_types() {
if (func_num_args() > 0) {
if (!func_get_arg(0)) {
throw coding_exception('core_plugin_manager->get_plugin_types() does not support relative paths.');
throw new coding_exception('core_plugin_manager->get_plugin_types() does not support relative paths.');
}
}
if ($this->plugintypes) {
Expand Down
4 changes: 2 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3651,7 +3651,7 @@ public function __construct($navnode) {
$this->$key = $value;
}
} else {
throw coding_exception('Not a valid breadcrumb_navigation_node');
throw new coding_exception('Not a valid breadcrumb_navigation_node');
}
}

Expand Down Expand Up @@ -3705,7 +3705,7 @@ public function __construct($navnode, $indent) {
$this->$key = $value;
}
} else {
throw coding_exception('Not a valid flat_navigation_node');
throw new coding_exception('Not a valid flat_navigation_node');
}
$this->indent = $indent;
}
Expand Down
2 changes: 1 addition & 1 deletion tag/classes/collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public static function delete($tagcoll) {
public static function change_sortorder($tagcoll, $direction) {
global $DB;
if ($direction != -1 && $direction != 1) {
throw coding_exception('Second argument in tag_coll_change_sortorder() can be only 1 or -1');
throw new coding_exception('Second argument in tag_coll_change_sortorder() can be only 1 or -1');
}
$tagcolls = self::get_collections();
$keys = array_keys($tagcolls);
Expand Down

0 comments on commit 6d721ca

Please sign in to comment.