Skip to content

Commit

Permalink
#10287 fix types (#10291)
Browse files Browse the repository at this point in the history
  • Loading branch information
taslangraham committed Aug 14, 2024
1 parent d95ecb1 commit 0fb17c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions controllers/grid/files/form/LibraryFileForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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']);
}
Expand Down
18 changes: 7 additions & 11 deletions controllers/grid/settings/library/form/EditLibraryFileForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0fb17c2

Please sign in to comment.