Skip to content
Snippets Groups Projects
Commit ea355bcf authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

make constructor final and use new static(), fixes #1250

Closes #1250

Merge request studip/studip!766
parent 307d6c1a
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ abstract class Interactable ...@@ -24,7 +24,7 @@ abstract class Interactable
* @param string $label the label of the button * @param string $label the label of the button
* @param array $attributes the attributes of the button element * @param array $attributes the attributes of the button element
*/ */
function __construct($label, $attributes) final public function __construct($label, $attributes)
{ {
$this->label = $label; $this->label = $label;
$this->attributes = $attributes; $this->attributes = $attributes;
...@@ -107,9 +107,9 @@ abstract class Interactable ...@@ -107,9 +107,9 @@ abstract class Interactable
* @param string $trait the specific trait of the current element * @param string $trait the specific trait of the current element
* @param array $attributes the attributes of the button element * @param array $attributes the attributes of the button element
* *
* @return returns a Interactable element * @return Interactable a Interactable element
*/ */
static function create($label = NULL, $trait = NULL, $attributes = []) public static function create($label = NULL, $trait = NULL, $attributes = [])
{ {
$argc = func_num_args(); $argc = func_num_args();
...@@ -126,8 +126,7 @@ abstract class Interactable ...@@ -126,8 +126,7 @@ abstract class Interactable
list($attributes, $trait) = [$trait, NULL]; list($attributes, $trait) = [$trait, NULL];
} }
$called = get_called_class(); $interactable = new static($label, $attributes);
$interactable = new $called($label, $attributes);
$interactable->initialize($label, $trait, $attributes); $interactable->initialize($label, $trait, $attributes);
return $interactable; return $interactable;
...@@ -154,7 +153,7 @@ abstract class Interactable ...@@ -154,7 +153,7 @@ abstract class Interactable
* @param string $trait the specific trait of the current element * @param string $trait the specific trait of the current element
* @param array $attributes the attributes of the button element * @param array $attributes the attributes of the button element
*/ */
static function createAccept($label = NULL, $trait = NULL, $attributes = []) public static function createAccept($label = NULL, $trait = NULL, $attributes = [])
{ {
$args = func_num_args() ? func_get_args() : [_('Übernehmen')]; $args = func_num_args() ? func_get_args() : [_('Übernehmen')];
return self::__callStatic(__FUNCTION__, $args); return self::__callStatic(__FUNCTION__, $args);
...@@ -170,7 +169,7 @@ abstract class Interactable ...@@ -170,7 +169,7 @@ abstract class Interactable
* @param string $trait the specific trait of the current element * @param string $trait the specific trait of the current element
* @param array $attributes the attributes of the button element * @param array $attributes the attributes of the button element
*/ */
static function createEdit($label = NULL, $trait = NULL, $attributes = []) public static function createEdit($label = NULL, $trait = NULL, $attributes = [])
{ {
$args = func_num_args() ? func_get_args() : [_('Bearbeiten')]; $args = func_num_args() ? func_get_args() : [_('Bearbeiten')];
return self::__callStatic(__FUNCTION__, $args); return self::__callStatic(__FUNCTION__, $args);
...@@ -186,7 +185,7 @@ abstract class Interactable ...@@ -186,7 +185,7 @@ abstract class Interactable
* @param string $trait the specific trait of the current element * @param string $trait the specific trait of the current element
* @param array $attributes the attributes of the button element * @param array $attributes the attributes of the button element
*/ */
static function createCancel($label = NULL, $trait = NULL, $attributes = []) public static function createCancel($label = NULL, $trait = NULL, $attributes = [])
{ {
$args = func_num_args() ? func_get_args() : [_('Abbrechen')]; $args = func_num_args() ? func_get_args() : [_('Abbrechen')];
return self::__callStatic(__FUNCTION__, $args); return self::__callStatic(__FUNCTION__, $args);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment