[CORE] Throw more meaningfull error when method doesn't exist in Security and Entity

This commit is contained in:
Hugo Sales 2021-05-12 15:44:09 +00:00
parent 6d93b6fb32
commit 9198797aea
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 6 additions and 2 deletions

View File

@ -40,7 +40,7 @@ abstract class Entity
$private_property_accessor = $private_property_accessor->bindTo($this, get_called_class());
return $private_property_accessor($prop);
}
throw new \Exception('Non existent method ' . get_called_class() . "::{$name} called with arguments: " . print_r($arguments, true));
throw new \BadMethodCallException('Non existent method ' . get_called_class() . "::{$name} called with arguments: " . print_r($arguments, true));
}
/**

View File

@ -49,7 +49,11 @@ abstract class Security
if (method_exists(self::$security, $name)) {
return self::$security->{$name}(...$args);
} else {
return self::$sanitizer->{$name}(...$args);
if (method_exists(self::$sanitizer, $name)) {
return self::$sanitizer->{$name}(...$args);
} else {
throw new \BadMethodCallException("Method Security::{$name} doesn't exist");
}
}
}
}