MDL-60281 general: various strict corrections for PHP7.2
- count() can only be called on arrays or Countable, it can not be called on null - recordset is neither so iterator_count() should be used - instanceof or get_class() can not be applied to non-objects - class methods must have the same arguments as methods in parent class
This commit is contained in:
@@ -164,8 +164,8 @@ abstract class base_nested_element extends base_final_element {
|
||||
}
|
||||
|
||||
public function add_child($element) {
|
||||
if (!($element instanceof base_nested_element)) { // parameter must be a base_nested_element
|
||||
if (!$found = get_class($element)) {
|
||||
if (!is_object($element) || !($element instanceof base_nested_element)) { // parameter must be a base_nested_element
|
||||
if (!is_object($element) || !($found = get_class($element))) {
|
||||
$found = 'non object';
|
||||
}
|
||||
throw new base_element_struct_exception('nestedelementincorrect', $found);
|
||||
|
||||
Reference in New Issue
Block a user