From 8b470f41330e79f5a43f971888a7324e60a1601a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org> Date: Tue, 9 Jun 2020 17:22:24 +0200 Subject: [PATCH] :ambulance: fix(errors) Fix PHP <7.1 syntax and code style issue #6071 --- include/errors/class_SimplePluginCheckError.inc | 2 +- .../simpleplugin/attributes/class_IntAttribute.inc | 4 ++-- .../attributes/class_StringAttribute.inc | 2 +- include/simpleplugin/class_Attribute.inc | 12 ++++++++++-- include/simpleplugin/class_simplePlugin.inc | 1 - 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/errors/class_SimplePluginCheckError.inc b/include/errors/class_SimplePluginCheckError.inc index dff0535ef..ee906dad9 100644 --- a/include/errors/class_SimplePluginCheckError.inc +++ b/include/errors/class_SimplePluginCheckError.inc @@ -30,7 +30,7 @@ class SimplePluginCheckError extends SimplePluginError * * \return HTML string */ - static public function invalidValue(string $error): string + static public function invalidValue (string $error): string { return sprintf( '<b>%s</b> %s', diff --git a/include/simpleplugin/attributes/class_IntAttribute.inc b/include/simpleplugin/attributes/class_IntAttribute.inc index b5218747a..e3252a8cc 100644 --- a/include/simpleplugin/attributes/class_IntAttribute.inc +++ b/include/simpleplugin/attributes/class_IntAttribute.inc @@ -45,7 +45,7 @@ class IntAttribute extends Attribute $this->max = ($max === FALSE ? FALSE : $this->inputValue($max)); } - public function getExample (): ?string + public function getExample () { if (($this->min !== FALSE) && ($this->max !== FALSE)) { return sprintf(_('An integer between %d and %d'), $this->min, $this->max); @@ -170,7 +170,7 @@ class FloatAttribute extends IntAttribute $this->step = 0.01; } - public function getExample (): ?string + public function getExample () { if (($this->min !== FALSE) && ($this->max !== FALSE)) { return sprintf(_('A float between %f and %f'), $this->min, $this->max); diff --git a/include/simpleplugin/attributes/class_StringAttribute.inc b/include/simpleplugin/attributes/class_StringAttribute.inc index 74a73ee93..4a3aec48e 100644 --- a/include/simpleplugin/attributes/class_StringAttribute.inc +++ b/include/simpleplugin/attributes/class_StringAttribute.inc @@ -53,7 +53,7 @@ class StringAttribute extends Attribute $this->example = $example; } - public function getExample (): ?string + public function getExample () { return $this->example; } diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index ebf5815a6..e03f20ef6 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -121,7 +121,11 @@ class Attribute $this->manageAttributes($this->getValue()); } - function getParent(): ?simplePlugin + /*! \brief Get parent plugin instance, if any + * + * \return simplePlugin|null + */ + function getParent () { return $this->plugin; } @@ -172,7 +176,11 @@ class Attribute return $this->inLdap; } - public function getExample (): ?string + /*! \brief Get an example value + * + * \return string|null + */ + public function getExample () { return NULL; } diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index b05acf8e0..0baa4b309 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -1468,7 +1468,6 @@ class simplePlugin implements SimpleTab default: trigger_error(sprintf('Invalid %s event type given: "%s"! Valid types are: add, modify, remove.', strtolower($when), $mode)); return []; - break; } } -- GitLab