From dc6a67c2f0c12644ba786d2273fdc55a9b05f2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:01:09 +0200 Subject: [PATCH] Made the ALLOWED_ELEMENT_CLASS protected so we can apply rector Its bad style to override a public const in a child class --- src/Entity/Attachments/Attachment.php | 12 +++++++++++- src/Entity/Parameters/AbstractParameter.php | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 7c07a465..bc3f52b8 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -71,8 +71,9 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. + * */ - public const ALLOWED_ELEMENT_CLASS = ''; + protected const ALLOWED_ELEMENT_CLASS = ''; /** * @var string|null the original filename the file had, when the user uploaded it @@ -463,4 +464,13 @@ abstract class Attachment extends AbstractNamedDBElement return (bool) filter_var($string, FILTER_VALIDATE_URL); } + + /** + * Returns the class of the element that is allowed to be associated with this attachment. + * @return string + */ + public function getElementClass(): string + { + return static::ALLOWED_ELEMENT_CLASS; + } } diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index b033c0ac..be918d00 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -64,7 +64,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. */ - public const ALLOWED_ELEMENT_CLASS = ''; + protected const ALLOWED_ELEMENT_CLASS = ''; /** * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short @@ -400,4 +400,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement return $str; } + + /** + * Returns the class of the element that is allowed to be associated with this attachment. + * @return string + */ + public function getElementClass(): string + { + return static::ALLOWED_ELEMENT_CLASS; + } }