Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Remove empty() check for $user #60

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Command/DigasBaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@
protected function notifyUser(User $feUser, array $userDocumentEntries)
{
// get fe_user data
if (!empty($feUser) && !empty($userDocumentEntries)) {
if (!empty($userDocumentEntries)) {
$documentsList = [];
foreach ($userDocumentEntries as $accessEntry) {
$documentsList[] = [
'recordId' => $accessEntry->getDlfDocument()->getRecordId(),

Check failure on line 212 in Classes/Command/DigasBaseCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method getRecordId() on an unknown class Slub\SlubWebDigas\Domain\Model\KitodoDocument.
'documentTitle' => $accessEntry->getDlfDocument()->getTitle(),

Check failure on line 213 in Classes/Command/DigasBaseCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method getTitle() on an unknown class Slub\SlubWebDigas\Domain\Model\KitodoDocument.
'endTime' => $accessEntry->getEndTime(),
'rejected' => $accessEntry->getRejected(),
'rejectedReason' => $accessEntry->getRejectedReason()
Expand Down
6 changes: 3 additions & 3 deletions Classes/Controller/AdministrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
*/
public function showAction(User $user)
{
if (!empty($user) && !empty($user->getUid())) {
if (!empty($user->getUid())) {
$this->view->assign('user', $this->userRepository->findByUid($user->getUid()));
$this->assignForAll();
}
Expand All @@ -96,7 +96,7 @@
*/
public function editUserAction(User $user)
{
if (!empty($user) && !empty($user->getUid())) {
if (!empty($user->getUid())) {
$token = GeneralUtility::hmac((string)$user->getUid(), (string)$user->getCrdate()->getTimestamp());

/** @var UserGroup[] $feUserGroup */
Expand Down Expand Up @@ -128,7 +128,7 @@
if ($user->getDisable() === true) {
$user->setInactivemessageTstamp(new \DateTime());
} else {
$user->setInactivemessageTstamp(null);

Check failure on line 131 in Classes/Controller/AdministrationController.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #1 $inactivemessageTstamp of method Slub\DigasFeManagement\Domain\Model\User::setInactivemessageTstamp() expects DateTime, null given.
}
$this->updateAllConfirmed($user);
$this->redirect('editUser', null, null, ['user' => $user]);
Expand All @@ -144,7 +144,7 @@
*/
public function deactivateUserAction(User $user, $setActiveState = false)
{
if (!empty($user)) {
if (!empty($user->getUid())) {
$this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__, [$user, $this]);
$logUtility = GeneralUtility::makeInstance(LogUtility::class);
$logUtility->log(Log::STATUS_ADMINISTRATION_PROFILE_DEACTIVATE, $user);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/BasketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
foreach ($requestedAccess as $access) {
$document = $access->getDlfDocument();
if ($document != NULL) {
$requestedDocuments[$document->getUid()] = $access;

Check failure on line 122 in Classes/Controller/BasketController.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method getUid() on an unknown class Slub\SlubWebDigas\Domain\Model\KitodoDocument.
}
}
}
Expand All @@ -139,7 +139,7 @@
}
}

$this->documents = [

Check failure on line 142 in Classes/Controller/BasketController.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Slub\DigasFeManagement\Controller\BasketController::$documents (TYPO3\CMS\Extbase\Persistence\Generic\QueryResult) does not accept array<string, array>.
'newDocumentRequests' => $newDocumentRequests,
'oldDocumentRequests' => $oldDocumentRequests,
'rejectedDocumentRequests' => $rejectedDocumentRequests
Expand Down Expand Up @@ -199,7 +199,7 @@
*/
public function requestAction()
{
if (!empty($this->documents)) {

Check failure on line 202 in Classes/Controller/BasketController.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Slub\DigasFeManagement\Controller\BasketController::$documents (TYPO3\CMS\Extbase\Persistence\Generic\QueryResult) in empty() is not falsy.
// request new documents
if (!empty($this->documents['newDocumentRequests'])) {
foreach ($this->documents['newDocumentRequests'] as $key => $document) {
Expand Down Expand Up @@ -233,7 +233,7 @@
setcookie('dlf-requests', '[]', 0, '/');

$message = !empty($this->requestParams['message']) ? $this->requestParams['message'] : '';
$this->sendRequestAccessMail($documents, $message);

Check failure on line 236 in Classes/Controller/BasketController.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter #1 $documents of method Slub\DigasFeManagement\Controller\BasketController::sendRequestAccessMail() expects array<Slub\SlubWebDigas\Domain\Model\KitodoDocument>, array<int, Slub\DigasFeManagement\Domain\Model\Access> given.

$this->addFlashMessage(
LocalizationUtility::translate(
Expand Down Expand Up @@ -263,7 +263,7 @@
*/
protected function checkUserLoggedIn()
{
if (empty($this->user) || empty($this->user->getUid())) {
if (empty($this->user->getUid())) {
$uriBuilder = $this->uriBuilder;
$uri = $uriBuilder->setTargetPageUid($this->settings['pids']['loginPage'])->build();
$this->redirectToUri($uri);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/StatisticController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function setKitodoStoragePid()
public function downloadLinkAction(string $id, string $countType)
{
// make sure, the user is logged in
if (empty($this->user) || empty($this->user->getUid())) {
if (empty($this->user->getUid())) {
$this->view->assign('counted', -1);
return;
}
Expand Down
Loading