Skip to content
Snippets Groups Projects
Commit d868873c authored by Torben Hansen's avatar Torben Hansen Committed by Benni Mack
Browse files

[TASK] Modernize ext:belog

* Use strict function argument and return types where possible
* Removed superfluous argument and return type doc comments
* Replaced deprecated strftime usage
* Removed invalid extension key for LocalizationUtility usage
* Replaced switch statement with match expression
* Removed superfluous type casts

Resolves: #98184
Releases: main
Change-Id: If2f4060f80f26c2116eb668220d009b7ae4281b1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75527


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarSusanne Moog <look@susi.dev>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 8e860361
Branches
Tags
No related merge requests found
...@@ -67,10 +67,6 @@ class BackendLogController extends ActionController ...@@ -67,10 +67,6 @@ class BackendLogController extends ActionController
/** /**
* Show general information and the installed modules * Show general information and the installed modules
*
* @param Constraint|null $constraint
* @param string $operation
* @return ResponseInterface
*/ */
public function listAction(Constraint $constraint = null, string $operation = ''): ResponseInterface public function listAction(Constraint $constraint = null, string $operation = ''): ResponseInterface
{ {
...@@ -134,8 +130,6 @@ class BackendLogController extends ActionController ...@@ -134,8 +130,6 @@ class BackendLogController extends ActionController
/** /**
* Delete all log entries that share the same message with the log entry given * Delete all log entries that share the same message with the log entry given
* in $errorUid * in $errorUid
*
* @param int $errorUid
*/ */
public function deleteMessageAction(int $errorUid): ResponseInterface public function deleteMessageAction(int $errorUid): ResponseInterface
{ {
...@@ -152,10 +146,8 @@ class BackendLogController extends ActionController ...@@ -152,10 +146,8 @@ class BackendLogController extends ActionController
/** /**
* Get module states (the constraint object) from user data * Get module states (the constraint object) from user data
*
* @return Constraint
*/ */
protected function getConstraintFromBeUserData() protected function getConstraintFromBeUserData(): Constraint
{ {
$serializedConstraint = $this->request->getAttribute('moduleData')->get('constraint'); $serializedConstraint = $this->request->getAttribute('moduleData')->get('constraint');
$constraint = null; $constraint = null;
...@@ -167,8 +159,6 @@ class BackendLogController extends ActionController ...@@ -167,8 +159,6 @@ class BackendLogController extends ActionController
/** /**
* Save current constraint object in be user settings (uC) * Save current constraint object in be user settings (uC)
*
* @param Constraint $constraint
*/ */
protected function persistConstraintInBeUserData(Constraint $constraint): void protected function persistConstraintInBeUserData(Constraint $constraint): void
{ {
...@@ -182,7 +172,7 @@ class BackendLogController extends ActionController ...@@ -182,7 +172,7 @@ class BackendLogController extends ActionController
* (memory exhaustion in php), reset the constraints in be user settings, so * (memory exhaustion in php), reset the constraints in be user settings, so
* the belog can be accessed again in the next call. * the belog can be accessed again in the next call.
*/ */
protected function resetConstraintsOnMemoryExhaustionError() protected function resetConstraintsOnMemoryExhaustionError(): void
{ {
$reservedMemory = new \SplFixedArray(187500); // 3M $reservedMemory = new \SplFixedArray(187500); // 3M
register_shutdown_function(function () use (&$reservedMemory): void { register_shutdown_function(function () use (&$reservedMemory): void {
...@@ -202,9 +192,6 @@ class BackendLogController extends ActionController ...@@ -202,9 +192,6 @@ class BackendLogController extends ActionController
* '12345' is a sub array to split entries by day, number is first second of day * '12345' is a sub array to split entries by day, number is first second of day
* *
* [pid][dayTimestamp][items] * [pid][dayTimestamp][items]
*
* @param QueryResultInterface $logEntries
* @return array
*/ */
protected function groupLogEntriesDay(QueryResultInterface $logEntries): array protected function groupLogEntriesDay(QueryResultInterface $logEntries): array
{ {
...@@ -217,8 +204,8 @@ class BackendLogController extends ActionController ...@@ -217,8 +204,8 @@ class BackendLogController extends ActionController
$targetStructure[-1] = []; $targetStructure[-1] = [];
} }
// Get day timestamp of log entry and create sub array if needed // Get day timestamp of log entry and create sub array if needed
// @todo Replace deprecated strftime in php 8.1. Suppress warning in v11. $entryTimestamp = \DateTimeImmutable::createFromFormat('U', (string)$entry->getTstamp());
$timestampDay = strtotime(@strftime('%d.%m.%Y', $entry->getTstamp()) ?: ''); $timestampDay = strtotime($entryTimestamp->format('d.m.Y'));
if (!is_array($targetStructure[$pid][$timestampDay] ?? false)) { if (!is_array($targetStructure[$pid][$timestampDay] ?? false)) {
$targetStructure[$pid][$timestampDay] = []; $targetStructure[$pid][$timestampDay] = [];
} }
...@@ -232,11 +219,11 @@ class BackendLogController extends ActionController ...@@ -232,11 +219,11 @@ class BackendLogController extends ActionController
/** /**
* Create options for the user / group drop down. * Create options for the user / group drop down.
* This is not moved to a repository by intention to not mix up this 'meta' data * This is not moved to a repository by intention to not mix up this 'meta' data
* with real repository work * with real repository work.
* *
* @return array Key is the option name, value its label * @return array Key is the option name, value its label
*/ */
protected function createUserAndGroupListForSelectOptions() protected function createUserAndGroupListForSelectOptions(): array
{ {
$userGroupArray = []; $userGroupArray = [];
// Two meta entries: 'all' and 'self' // Two meta entries: 'all' and 'self'
...@@ -275,7 +262,7 @@ class BackendLogController extends ActionController ...@@ -275,7 +262,7 @@ class BackendLogController extends ActionController
* *
* @return array Key is uid of workspace, value its label * @return array Key is uid of workspace, value its label
*/ */
protected function createWorkspaceListForSelectOptions() protected function createWorkspaceListForSelectOptions(): array
{ {
if (!ExtensionManagementUtility::isLoaded('workspaces')) { if (!ExtensionManagementUtility::isLoaded('workspaces')) {
return []; return [];
...@@ -314,29 +301,25 @@ class BackendLogController extends ActionController ...@@ -314,29 +301,25 @@ class BackendLogController extends ActionController
/** /**
* Create options for the 'depth of page levels' selector. * Create options for the 'depth of page levels' selector.
* This is shown if the module is displayed in page -> info
* *
* @return array Key is depth identifier (1 = One level), value the localized select option label * @return array Key is depth identifier (1 = One level), value the localized select option label
*/ */
protected function createPageDepthOptions() protected function createPageDepthOptions(): array
{ {
$options = [ return [
0 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0', 'lang'), 0 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
1 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_1', 'lang'), 1 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
2 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_2', 'lang'), 2 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
3 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_3', 'lang'), 3 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
4 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_4', 'lang'), 4 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
999 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi', 'lang'), 999 => LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
]; ];
return $options;
} }
/** /**
* Calculate the start- and end timestamp * Calculate the start- and end timestamp
*
* @param Constraint $constraint
*/ */
protected function setStartAndEndTimeFromTimeSelector(Constraint $constraint) protected function setStartAndEndTimeFromTimeSelector(Constraint $constraint): void
{ {
$startTime = $constraint->getManualDateStart() ? $constraint->getManualDateStart()->getTimestamp() : 0; $startTime = $constraint->getManualDateStart() ? $constraint->getManualDateStart()->getTimestamp() : 0;
$endTime = $constraint->getManualDateStop() ? $constraint->getManualDateStop()->getTimestamp() : 0; $endTime = $constraint->getManualDateStop() ? $constraint->getManualDateStop()->getTimestamp() : 0;
......
...@@ -18,6 +18,7 @@ declare(strict_types=1); ...@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Belog\Controller; namespace TYPO3\CMS\Belog\Controller;
use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent; use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent;
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus; use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
...@@ -32,10 +33,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; ...@@ -32,10 +33,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/ */
final class SystemInformationController final class SystemInformationController
{ {
/** protected array $backendUserConfiguration;
* @var array
*/
protected $backendUserConfiguration;
public function __construct(array $backendUserConfiguration = null) public function __construct(array $backendUserConfiguration = null)
{ {
...@@ -44,8 +42,7 @@ final class SystemInformationController ...@@ -44,8 +42,7 @@ final class SystemInformationController
/** /**
* Modifies the SystemInformation toolbar to inject a new message * Modifies the SystemInformation toolbar to inject a new message
* @param SystemInformationToolbarCollectorEvent $event * @throws RouteNotFoundException
* @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
*/ */
public function appendMessage(SystemInformationToolbarCollectorEvent $event): void public function appendMessage(SystemInformationToolbarCollectorEvent $event): void
{ {
......
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of the TYPO3 CMS project. * This file is part of the TYPO3 CMS project.
* *
...@@ -25,287 +27,165 @@ class Constraint ...@@ -25,287 +27,165 @@ class Constraint
{ {
/** /**
* Selected user/group; possible values are "gr-<uid>" for a group, "us-<uid>" for a user or -1 for "all users" * Selected user/group; possible values are "gr-<uid>" for a group, "us-<uid>" for a user or -1 for "all users"
*
* @var string
*/ */
protected $userOrGroup = '0'; protected string $userOrGroup = '0';
/** /**
* Number of log rows to show * Number of log rows to show
*
* @var int
*/ */
protected $number = 20; protected int $number = 20;
/** /**
* UID of selected workspace * UID of selected workspace
*
* @var int
*/ */
protected $workspaceUid = -99; protected int $workspaceUid = -99;
/** /**
* Selected channel * Selected channel
*
* @var string
*/ */
protected string $channel = ''; protected string $channel = '';
/** /**
* Selected level * Selected level
*
* @var string
*/ */
protected string $level = LogLevel::DEBUG; protected string $level = LogLevel::DEBUG;
/** /**
* Calculated start timestamp * Calculated start timestamp
*
* @var int
*/ */
protected $startTimestamp = 0; protected int $startTimestamp = 0;
/** /**
* Calculated end timestamp * Calculated end timestamp
*
* @var int
*/ */
protected $endTimestamp = 0; protected int $endTimestamp = 0;
/** /**
* Manual date start * Manual date start
* @var \DateTime|null
*/ */
protected $manualDateStart; protected ?\DateTime $manualDateStart = null;
/** /**
* Manual date stop * Manual date stop
* @var \DateTime|null
*/ */
protected $manualDateStop; protected ?\DateTime $manualDateStop = null;
/** /**
* Selected page ID in page context * Selected page ID in page context
*
* @var int
*/ */
protected $pageId = 0; protected int $pageId = 0;
/** /**
* Page level depth * Page level depth
*
* @var int
*/ */
protected $depth = 0; protected int $depth = 0;
/** public function setUserOrGroup(string $user): void
* Set user
*
* @param string $user
*/
public function setUserOrGroup($user)
{ {
$this->userOrGroup = $user; $this->userOrGroup = $user;
} }
/** public function getUserOrGroup(): string
* Get user
*
* @return string
*/
public function getUserOrGroup()
{ {
return $this->userOrGroup; return $this->userOrGroup;
} }
/** public function setNumber(int $number): void
* Set number of log rows to show
*
* @param int $number
*/
public function setNumber($number)
{ {
$this->number = (int)$number; $this->number = (int)$number;
} }
/** public function getNumber(): int
* Get number of log entries to show
*
* @return int
*/
public function getNumber()
{ {
return $this->number; return $this->number;
} }
/** public function setWorkspaceUid(int $workspace): void
* Set workspace
*
* @param int $workspace
*/
public function setWorkspaceUid($workspace)
{ {
$this->workspaceUid = $workspace; $this->workspaceUid = $workspace;
} }
/** public function getWorkspaceUid(): int
* Get workspace
*
* @return int
*/
public function getWorkspaceUid()
{ {
return $this->workspaceUid; return $this->workspaceUid;
} }
/**
* Set channel
*/
public function setChannel(string $channel): void public function setChannel(string $channel): void
{ {
$this->channel = $channel; $this->channel = $channel;
} }
/**
* Get channel
*/
public function getChannel(): string public function getChannel(): string
{ {
return $this->channel; return $this->channel;
} }
/**
* Set level
*/
public function setLevel(string $level): void public function setLevel(string $level): void
{ {
$this->level = $level; $this->level = $level;
} }
/**
* Get level
*/
public function getLevel(): string public function getLevel(): string
{ {
return $this->level; return $this->level;
} }
/** public function setStartTimestamp(int $timestamp): void
* Set calculated start timestamp from query constraints
*
* @param int $timestamp
*/
public function setStartTimestamp($timestamp)
{ {
$this->startTimestamp = (int)$timestamp; $this->startTimestamp = $timestamp;
} }
/** public function getStartTimestamp(): int
* Get calculated start timestamp from query constraints
*
* @return int
*/
public function getStartTimestamp()
{ {
return $this->startTimestamp; return $this->startTimestamp;
} }
/** public function setEndTimestamp(int $timestamp): void
* Set calculated end timestamp from query constraints
*
* @param int $timestamp
*/
public function setEndTimestamp($timestamp)
{ {
$this->endTimestamp = (int)$timestamp; $this->endTimestamp = $timestamp;
} }
/** public function getEndTimestamp(): int
* Get calculated end timestamp from query constraints
*
* @return int
*/
public function getEndTimestamp()
{ {
return $this->endTimestamp; return $this->endTimestamp;
} }
/** public function setPageId(int $id): void
* Set page id
*
* @param int $id
*/
public function setPageId($id)
{ {
$this->pageId = (int)$id; $this->pageId = $id;
} }
/** public function getPageId(): int
* Get page id
*
* @return int
*/
public function getPageId()
{ {
return $this->pageId; return $this->pageId;
} }
/** public function setDepth(int $depth): void
* Set page level depth
*
* @param int $depth
*/
public function setDepth($depth)
{ {
$this->depth = $depth; $this->depth = $depth;
} }
/** public function getDepth(): int
* Get page level depth
*
* @return int
*/
public function getDepth()
{ {
return (int)$this->depth; return $this->depth;
} }
/** public function setManualDateStart(?\DateTime $manualDateStart = null): void
* Set manual date start
*
* @param \DateTime $manualDateStart
*/
public function setManualDateStart(\DateTime $manualDateStart = null)
{ {
$this->manualDateStart = $manualDateStart; $this->manualDateStart = $manualDateStart;
} }
/** public function getManualDateStart(): ?\DateTime
* Get manual date start
*
* @return \DateTime|null
*/
public function getManualDateStart()
{ {
return $this->manualDateStart; return $this->manualDateStart;
} }
/** public function setManualDateStop(?\DateTime $manualDateStop = null): void
* Set manual date stop
*
* @param \DateTime $manualDateStop
*/
public function setManualDateStop(\DateTime $manualDateStop = null)
{ {
$this->manualDateStop = $manualDateStop; $this->manualDateStop = $manualDateStop;
} }
/** public function getManualDateStop(): ?\DateTime
* Get manual date stop
*
* @return \DateTime|null
*/
public function getManualDateStop()
{ {
return $this->manualDateStop; return $this->manualDateStop;
} }
......
<?php <?php
declare(strict_types=1);
/* /*
* This file is part of the TYPO3 CMS project. * This file is part of the TYPO3 CMS project.
* *
...@@ -87,7 +89,7 @@ class LogEntry extends AbstractEntity ...@@ -87,7 +89,7 @@ class LogEntry extends AbstractEntity
/** /**
* Channel name. * Channel name.
*/ */
protected string $channel = 'narf'; protected string $channel = '';
/** /**
* Level. * Level.
...@@ -123,164 +125,85 @@ class LogEntry extends AbstractEntity ...@@ -123,164 +125,85 @@ class LogEntry extends AbstractEntity
* New ID * New ID
* *
* @var string * @var string
* @todo: should be string|int but extbase chokes on this while mapping * @todo: should be string|int but extbase chokes on this while mapping - see #98132
*/ */
protected $newId = 0; protected $newId = 0;
/** public function setBackendUserUid(int $beUserUid): void
* Set backend user uid
*
* @param int $beUserUid
*/
public function setBackendUserUid($beUserUid)
{ {
$this->backendUserUid = $beUserUid; $this->backendUserUid = $beUserUid;
} }
/** public function getBackendUserUid(): int
* Get backend user id
*
* @return int
*/
public function getBackendUserUid()
{ {
return $this->backendUserUid; return $this->backendUserUid;
} }
/** public function setAction(int $action): void
* Set action
*
* @param int $action
*/
public function setAction($action)
{ {
$this->action = $action; $this->action = $action;
} }
/** public function getAction(): int
* Get action
*
* @return int
*/
public function getAction()
{ {
return (int)$this->action; return $this->action;
} }
/** public function setRecordUid(int $recordUid): void
* Set record uid
*
* @param int $recordUid
*/
public function setRecordUid($recordUid)
{ {
$this->recordUid = $recordUid; $this->recordUid = $recordUid;
} }
/** public function getRecordUid(): int
* Get record uid
*
* @return int
*/
public function getRecordUid()
{ {
return (int)$this->recordUid; return $this->recordUid;
} }
/** public function setTableName(string $tableName): void
* Set table name
*
* @param string $tableName
*/
public function setTableName($tableName)
{ {
$this->tableName = $tableName; $this->tableName = $tableName;
} }
/** public function getTableName(): string
* Get table name
*
* @return string
*/
public function getTableName()
{ {
return $this->tableName; return $this->tableName;
} }
/** public function setRecordPid(int $recordPid): void
* Set record pid
*
* @param int $recordPid
*/
public function setRecordPid($recordPid)
{ {
$this->recordPid = $recordPid; $this->recordPid = $recordPid;
} }
/** public function getRecordPid(): int
* Get record pid
*
* @return int
*/
public function getRecordPid()
{ {
return (int)$this->recordPid; return $this->recordPid;
} }
/** public function setError(int $error): void
* Set error
*
* @param int $error
*/
public function setError($error)
{ {
$this->error = $error; $this->error = $error;
} }
/** public function getError(): int
* Get error
*
* @return int
*/
public function getError()
{ {
return (int)$this->error; return $this->error;
} }
/**
* Get class name for the error code
*
* @return string
*/
public function getErrorIconClass(): string public function getErrorIconClass(): string
{ {
switch ($this->getError()) { return match ($this->getError()) {
case 1: 1 => 'status-dialog-warning',
return 'status-dialog-warning'; 2, 3 => 'status-dialog-error',
case 2: default => 'empty-empty',
case 3: };
return 'status-dialog-error';
default:
return 'empty-empty';
}
} }
/** public function setDetails(string $details): void
* Set details
*
* @param string $details
*/
public function setDetails($details)
{ {
$this->details = $details; $this->details = $details;
} }
/** public function getDetails(): string
* Get details
*
* @return string
*/
public function getDetails()
{ {
if ($this->type === 255) { if ($this->type === 255) {
return str_replace('###IP###', $this->ip, $this->details); return str_replace('###IP###', $this->ip, $this->details);
...@@ -288,134 +211,72 @@ class LogEntry extends AbstractEntity ...@@ -288,134 +211,72 @@ class LogEntry extends AbstractEntity
return $this->details; return $this->details;
} }
/** public function setTstamp(int $tstamp): void
* Set tstamp
*
* @param int $tstamp
*/
public function setTstamp($tstamp)
{ {
$this->tstamp = $tstamp; $this->tstamp = $tstamp;
} }
/** public function getTstamp(): int
* Get tstamp
*
* @return int
*/
public function getTstamp()
{ {
return (int)$this->tstamp; return $this->tstamp;
} }
/** public function setType(int $type): void
* Set type
*
* @param int $type
*/
public function setType($type)
{ {
$this->type = $type; $this->type = $type;
} }
/** public function getType(): int
* Get type
*
* @return int
*/
public function getType()
{ {
return (int)$this->type; return $this->type;
} }
/**
* Set channel
*/
public function setChannel(string $channel): void public function setChannel(string $channel): void
{ {
$this->channel = $channel; $this->channel = $channel;
} }
/**
* Get channel
*/
public function getChannel(): string public function getChannel(): string
{ {
return $this->channel; return $this->channel;
} }
/**
* Set level
*/
public function setLevel(string $level): void public function setLevel(string $level): void
{ {
$this->level = $level; $this->level = $level;
} }
/**
* Get level
*/
public function getLevel(): string public function getLevel(): string
{ {
return $this->level; return $this->level;
} }
/** public function setDetailsNumber(int $detailsNumber): void
* Set details number
*
* @param int $detailsNumber
*/
public function setDetailsNumber($detailsNumber)
{ {
$this->detailsNumber = $detailsNumber; $this->detailsNumber = $detailsNumber;
} }
/** public function getDetailsNumber(): int
* Get details number
*
* @return int
*/
public function getDetailsNumber()
{ {
return (int)$this->detailsNumber; return $this->detailsNumber;
} }
/** public function setIp(string $ip): void
* Set ip
*
* @param string $ip
*/
public function setIp($ip)
{ {
$this->ip = $ip; $this->ip = $ip;
} }
/** public function getIp(): string
* Get ip
*
* @return string
*/
public function getIp()
{ {
return $this->ip; return $this->ip;
} }
/** public function setLogData(string $logData): void
* Set log data
*
* @param string $logData
*/
public function setLogData($logData)
{ {
$this->logData = $logData; $this->logData = $logData;
} }
/** public function getLogData(): array
* Get log data
*
* @return array
*/
public function getLogData()
{ {
if ($this->logData === '') { if ($this->logData === '') {
return []; return [];
...@@ -424,44 +285,24 @@ class LogEntry extends AbstractEntity ...@@ -424,44 +285,24 @@ class LogEntry extends AbstractEntity
return $logData ?? []; return $logData ?? [];
} }
/** public function setEventPid(int $eventPid): void
* Set event pid
*
* @param int $eventPid
*/
public function setEventPid($eventPid)
{ {
$this->eventPid = $eventPid; $this->eventPid = $eventPid;
} }
/** public function getEventPid(): int
* Get event pid
*
* @return int
*/
public function getEventPid()
{ {
return (int)$this->eventPid; return $this->eventPid;
} }
/** public function setWorkspaceUid(int $workspaceUid): void
* Set workspace uid
*
* @param int $workspaceUid
*/
public function setWorkspaceUid($workspaceUid)
{ {
$this->workspaceUid = $workspaceUid; $this->workspaceUid = $workspaceUid;
} }
/** public function getWorkspaceUid(): int
* Get workspace
*
* @return int
*/
public function getWorkspaceUid()
{ {
return (int)$this->workspaceUid; return $this->workspaceUid;
} }
/** /**
...@@ -469,7 +310,7 @@ class LogEntry extends AbstractEntity ...@@ -469,7 +310,7 @@ class LogEntry extends AbstractEntity
* *
* @param string $newId * @param string $newId
*/ */
public function setNewId($newId) public function setNewId($newId): void
{ {
$this->newId = $newId; $this->newId = $newId;
} }
......
...@@ -21,7 +21,6 @@ use Psr\Log\LogLevel; ...@@ -21,7 +21,6 @@ use Psr\Log\LogLevel;
use TYPO3\CMS\Backend\Tree\View\PageTreeView; use TYPO3\CMS\Backend\Tree\View\PageTreeView;
use TYPO3\CMS\Belog\Domain\Model\Constraint; use TYPO3\CMS\Belog\Domain\Model\Constraint;
use TYPO3\CMS\Belog\Domain\Model\LogEntry; use TYPO3\CMS\Belog\Domain\Model\LogEntry;
use TYPO3\CMS\Belog\Domain\Model\Workspace;
use TYPO3\CMS\Core\Authentication\GroupResolver; use TYPO3\CMS\Core\Authentication\GroupResolver;
use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\LogLevel as Typo3LogLevel; use TYPO3\CMS\Core\Log\LogLevel as Typo3LogLevel;
...@@ -41,9 +40,6 @@ class LogEntryRepository extends Repository ...@@ -41,9 +40,6 @@ class LogEntryRepository extends Repository
{ {
public ?QuerySettingsInterface $querySettings = null; public ?QuerySettingsInterface $querySettings = null;
/**
* @param QuerySettingsInterface $querySettings
*/
public function injectQuerySettings(QuerySettingsInterface $querySettings): void public function injectQuerySettings(QuerySettingsInterface $querySettings): void
{ {
$this->querySettings = $querySettings; $this->querySettings = $querySettings;
...@@ -59,9 +55,6 @@ class LogEntryRepository extends Repository ...@@ -59,9 +55,6 @@ class LogEntryRepository extends Repository
/** /**
* Finds all log entries that match all given constraints. * Finds all log entries that match all given constraints.
*
* @param Constraint $constraint
* @return QueryResultInterface
*/ */
public function findByConstraint(Constraint $constraint): QueryResultInterface public function findByConstraint(Constraint $constraint): QueryResultInterface
{ {
...@@ -80,8 +73,6 @@ class LogEntryRepository extends Repository ...@@ -80,8 +73,6 @@ class LogEntryRepository extends Repository
/** /**
* Create an array of query constraints from constraint object * Create an array of query constraints from constraint object
* *
* @param QueryInterface $query
* @param Constraint $constraint
* @return ConstraintInterface[] * @return ConstraintInterface[]
*/ */
protected function createQueryConstraints(QueryInterface $query, Constraint $constraint): array protected function createQueryConstraints(QueryInterface $query, Constraint $constraint): array
...@@ -90,7 +81,7 @@ class LogEntryRepository extends Repository ...@@ -90,7 +81,7 @@ class LogEntryRepository extends Repository
// User / group handling // User / group handling
$this->addUsersAndGroupsToQueryConstraints($constraint, $query, $queryConstraints); $this->addUsersAndGroupsToQueryConstraints($constraint, $query, $queryConstraints);
// Workspace // Workspace
if ((int)$constraint->getWorkspaceUid() !== -99) { if ($constraint->getWorkspaceUid() !== -99) {
$queryConstraints[] = $query->equals('workspace', $constraint->getWorkspaceUid()); $queryConstraints[] = $query->equals('workspace', $constraint->getWorkspaceUid());
} }
// Channel // Channel
...@@ -113,10 +104,6 @@ class LogEntryRepository extends Repository ...@@ -113,10 +104,6 @@ class LogEntryRepository extends Repository
/** /**
* Adds constraints for the page(s) to the query; this could be one single page or a whole subtree beneath a given * Adds constraints for the page(s) to the query; this could be one single page or a whole subtree beneath a given
* page. * page.
*
* @param Constraint $constraint
* @param QueryInterface $query
* @param array $queryConstraints the query constraints to add to, will be modified
*/ */
protected function addPageTreeConstraintsToQuery( protected function addPageTreeConstraintsToQuery(
Constraint $constraint, Constraint $constraint,
...@@ -143,10 +130,6 @@ class LogEntryRepository extends Repository ...@@ -143,10 +130,6 @@ class LogEntryRepository extends Repository
/** /**
* Adds users and groups to the query constraints. * Adds users and groups to the query constraints.
*
* @param Constraint $constraint
* @param QueryInterface $query
* @param array $queryConstraints the query constraints to add to, will be modified
*/ */
protected function addUsersAndGroupsToQueryConstraints( protected function addUsersAndGroupsToQueryConstraints(
Constraint $constraint, Constraint $constraint,
...@@ -179,9 +162,6 @@ class LogEntryRepository extends Repository ...@@ -179,9 +162,6 @@ class LogEntryRepository extends Repository
/** /**
* Deletes all messages which have the same message details * Deletes all messages which have the same message details
*
* @param LogEntry $logEntry
* @return int
*/ */
public function deleteByMessageDetails(LogEntry $logEntry): int public function deleteByMessageDetails(LogEntry $logEntry): int
{ {
......
...@@ -67,7 +67,7 @@ final class FormatDetailsViewHelper extends AbstractViewHelper ...@@ -67,7 +67,7 @@ final class FormatDetailsViewHelper extends AbstractViewHelper
protected static function stripPathFromFilenames(array $files = []): array protected static function stripPathFromFilenames(array $files = []): array
{ {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
$files[$key] = PathUtility::basename($file); $files[$key] = PathUtility::basename((string)$file);
} }
return $files; return $files;
} }
......
...@@ -33,10 +33,8 @@ final class UsernameViewHelper extends AbstractViewHelper ...@@ -33,10 +33,8 @@ final class UsernameViewHelper extends AbstractViewHelper
/** /**
* First level cache of user names * First level cache of user names
*
* @var array
*/ */
protected static $usernameRuntimeCache = []; protected static array $usernameRuntimeCache = [];
/** /**
* Initializes the arguments * Initializes the arguments
......
...@@ -77,4 +77,36 @@ class LogEntryTest extends UnitTestCase ...@@ -77,4 +77,36 @@ class LogEntryTest extends UnitTestCase
$this->subject->setLogData(serialize(new \stdClass())); $this->subject->setLogData(serialize(new \stdClass()));
self::assertSame([], $this->subject->getLogData()); self::assertSame([], $this->subject->getLogData());
} }
public function getErrorIconReturnsCorrespondingClassDataProvider(): array
{
return [
'empty' => [
0,
'empty-empty',
],
'warning' => [
1,
'status-dialog-warning',
],
'error 2' => [
2,
'status-dialog-error',
],
'error 3' => [
3,
'status-dialog-error',
],
];
}
/**
* @test
* @dataProvider getErrorIconReturnsCorrespondingClassDataProvider
*/
public function getErrorIconReturnsCorrespondingClass(int $error, string $expectedClass): void
{
$this->subject->setError($error);
self::assertSame($expectedClass, $this->subject->getErrorIconClass());
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment