Verified Commit 76ceb6f1 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Errors) - adapt errors classes to php82

Adapt errors classes to php82
No related merge requests found
Showing with 14 additions and 16 deletions
+14 -16
......@@ -29,7 +29,6 @@ class FatalError extends Error
public function __construct (string $htmlMessage = '', int $code = 0, Throwable $previous = NULL)
{
$this->htmlMessage = $htmlMessage;
parent::__construct(htmlunescape(strip_tags($htmlMessage)), $code, $previous);
}
public function getHtmlMessage ()
......
......@@ -28,7 +28,6 @@ class FusionDirectoryError extends Error
public function __construct (string $htmlMessage = '', int $code = 0, Throwable $previous = NULL)
{
$this->htmlMessage = $htmlMessage;
parent::__construct(htmlunescape(strip_tags($htmlMessage)), $code, $previous);
}
public function getHtmlMessage ()
......@@ -39,14 +38,14 @@ class FusionDirectoryError extends Error
public function toArray (): array
{
return [
'class' => get_class($this),
'class' => static::class,
'message' => $this->getMessage(),
'line' => $this->getLine(),
'file' => $this->getFile(),
];
}
public function __toString ()
public function __toString (): string
{
return $this->getMessage();
}
......
......@@ -21,7 +21,7 @@
/*! \class SimplePluginError
\brief Error returned by any method of SimplePlugin
*/
class SimplePluginError extends FusionDirectoryError
class SimplePluginError extends FusionDirectoryError implements \Stringable
{
protected $object;
protected $tab;
......@@ -49,7 +49,7 @@ class SimplePluginError extends FusionDirectoryError
$this->tab = NULL;
$this->object = $origin;
} elseif ($origin !== NULL) {
trigger_error('Invalid origin of class '.get_class($origin));
trigger_error('Invalid origin of class '.$origin::class);
}
}
if (!$this->object instanceof simpleTabs) {
......@@ -66,7 +66,7 @@ class SimplePluginError extends FusionDirectoryError
}
if (isset($this->tab)) {
$array['tab'] = get_class($this->tab);
$array['tab'] = $this->tab::class;
}
if (isset($this->attribute)) {
......@@ -76,7 +76,7 @@ class SimplePluginError extends FusionDirectoryError
return $array;
}
public function __toString ()
public function __toString (): string
{
$msg = '';
......@@ -84,8 +84,8 @@ class SimplePluginError extends FusionDirectoryError
$msg .= $this->object->dn.' > ';
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$msg .= $this->tab->parent->by_name[get_class($this->tab)].' > ';
if (isset($this->tab) && isset($this->tab->parent->by_name[$this->tab::class])) {
$msg .= $this->tab->parent->by_name[$this->tab::class].' > ';
}
if (isset($this->attribute)) {
......@@ -110,8 +110,8 @@ class SimplePluginError extends FusionDirectoryError
$breadcrumbs[] = htmlescape($this->object->dn);
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$breadcrumbs[] = htmlescape($this->tab->parent->by_name[get_class($this->tab)]);
if (isset($this->tab) && isset($this->tab->parent->by_name[$this->tab::class])) {
$breadcrumbs[] = htmlescape($this->tab->parent->by_name[$this->tab::class]);
}
if (isset($this->attribute)) {
......
......@@ -50,8 +50,8 @@ class SimplePluginHookError extends SimplePluginError
$html .= htmlescape($this->object->dn.' > ');
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$html .= htmlescape($this->tab->parent->by_name[get_class($this->tab)].' > ');
if (isset($this->tab) && isset($this->tab->parent->by_name[$this->tab::class])) {
$html .= htmlescape($this->tab->parent->by_name[$this->tab::class].' > ');
}
if (isset($this->attribute)) {
......
......@@ -57,8 +57,8 @@ class SimplePluginLdapError extends SimplePluginError
$html .= htmlescape($this->object->dn.' > ');
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$html .= htmlescape($this->tab->parent->by_name[get_class($this->tab)].' > ');
if (isset($this->tab) && isset($this->tab->parent->by_name[$this->tab::class])) {
$html .= htmlescape($this->tab->parent->by_name[$this->tab::class].' > ');
}
if (isset($this->attribute)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment