From 5ebdfdc4bb3e8c02c9ba98e2d30367a0c48dbac7 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Wed, 6 Jul 2022 12:28:01 +0000 Subject: [PATCH] use own constructor interface for StandardFile, fixes #1280 Closes #1280 Merge request studip/studip!784 --- lib/filesystem/FileType.php | 8 -------- lib/filesystem/StandardFile.php | 2 +- lib/filesystem/StandardFileInterface.php | 11 +++++++++++ lib/filesystem/UnknownFileType.php | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 lib/filesystem/StandardFileInterface.php diff --git a/lib/filesystem/FileType.php b/lib/filesystem/FileType.php index 60bfa441eab..003ee856a9a 100644 --- a/lib/filesystem/FileType.php +++ b/lib/filesystem/FileType.php @@ -2,14 +2,6 @@ interface FileType { - /** - * StandardFile constructor. - * @param $fileref - * @param null $file : (optional) Is set if fileref and file are both new and not connected with - * each other in the database. - */ - public function __construct($fileref, $file = null); - /** * Returns the name of the icon shape that shall be used with the FileType implementation. * diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php index 3fe3672e723..5c9b5e8b76e 100644 --- a/lib/filesystem/StandardFile.php +++ b/lib/filesystem/StandardFile.php @@ -12,7 +12,7 @@ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 * @category Stud.IP */ -class StandardFile implements FileType, ArrayAccess +class StandardFile implements FileType, ArrayAccess, StandardFileInterface { /** diff --git a/lib/filesystem/StandardFileInterface.php b/lib/filesystem/StandardFileInterface.php new file mode 100644 index 00000000000..a246550538c --- /dev/null +++ b/lib/filesystem/StandardFileInterface.php @@ -0,0 +1,11 @@ +<?php +interface StandardFileInterface +{ + /** + * StandardFile constructor. + * @param $fileref + * @param null $file : (optional) Is set if fileref and file are both new and not connected with + * each other in the database. + */ + public function __construct($fileref, $file = null); +} diff --git a/lib/filesystem/UnknownFileType.php b/lib/filesystem/UnknownFileType.php index c8df875fe09..effe75178de 100644 --- a/lib/filesystem/UnknownFileType.php +++ b/lib/filesystem/UnknownFileType.php @@ -20,7 +20,7 @@ class UnknownFileType implements FileType, ArrayAccess */ protected $fileref = null; - public function __construct($fileref = null, $file = null) + public function __construct($fileref = null) { $this->fileref = $fileref; } -- GitLab