diff --git a/controllers/grid/files/form/LibraryFileForm.php b/controllers/grid/files/form/LibraryFileForm.php index dd3b13f3907..d5d809ecd5b 100644 --- a/controllers/grid/files/form/LibraryFileForm.php +++ b/controllers/grid/files/form/LibraryFileForm.php @@ -22,8 +22,8 @@ class LibraryFileForm extends Form { - /** @var LibraryFileManager the library file manager instantiated in this form. */ - public $libraryFileManager; + /** the library file manager instantiated in this form. */ + public LibraryFileManager $libraryFileManager; /** * Constructor. @@ -56,7 +56,7 @@ function ($type) use ($libraryFileManager) { * * @param null|mixed $template */ - public function fetch($request, $template = null, $display = false) + public function fetch($request, $template = null, $display = false): ?string { // load the file types for the selector on the form. $templateMgr = TemplateManager::getManager($request); @@ -71,7 +71,7 @@ public function fetch($request, $template = null, $display = false) * * @see Form::readInputData() */ - public function readInputData() + public function readInputData(): void { $this->readUserVars(['libraryFileName', 'fileType', 'publicAccess']); } diff --git a/controllers/grid/settings/library/form/EditLibraryFileForm.php b/controllers/grid/settings/library/form/EditLibraryFileForm.php index 35cef93e835..785d75dc2c0 100644 --- a/controllers/grid/settings/library/form/EditLibraryFileForm.php +++ b/controllers/grid/settings/library/form/EditLibraryFileForm.php @@ -26,16 +26,12 @@ class EditLibraryFileForm extends LibraryFileForm { - /** @var LibraryFile the file being edited, or null for new */ - public $libraryFile; - - /** @var int the id of the context this library file is attached to */ - public $contextId; + /** The file being edited, or null for new */ + public ?LibraryFile $libraryFile; /** * Constructor. * - * @param int $contextId * @param int $fileId optional */ public function __construct(int $contextId, $fileId) @@ -54,16 +50,16 @@ public function __construct(int $contextId, $fileId) * * @see Form::readInputData() */ - public function readInputData() + public function readInputData(): void { $this->readUserVars(['temporaryFileId']); - return parent::readInputData(); + parent::readInputData(); } /** * Initialize form data from current settings. */ - public function initData() + public function initData(): void { $this->_data = [ 'libraryFileName' => $this->libraryFile->getName(null), // Localized @@ -81,13 +77,13 @@ public function execute(...$functionArgs) $userId = Application::get()->getRequest()->getUser()->getId(); // Fetch the temporary file storing the uploaded library file - $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); /* @var $temporaryFileDao TemporaryFileDAO */ + $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); /* @var \PKP\file\TemporaryFileDAO $temporaryFileDao*/ $temporaryFile = $temporaryFileDao->getTemporaryFile( $this->getData('temporaryFileId'), $userId ); if ($temporaryFile) { - $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); /* @var $libraryFileDao LibraryFileDAO */ + $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); /* @var LibraryFileDAO $libraryFileDao */ $libraryFileManager = new LibraryFileManager($this->contextId); // Convert the temporary file to a library file and store