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

Refactor admin_audit app #39234

Merged
merged 2 commits into from
Feb 23, 2024
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 apps/admin_audit/lib/Actions/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class Console extends Action {
/**
* @param $arguments
* @param array $arguments
*/
public function runCommand(array $arguments): void {
if (!isset($arguments[1]) || $arguments[1] === '_completion') {
Expand Down
1 change: 0 additions & 1 deletion apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
use Psr\Log\LoggerInterface;

class Application extends App implements IBootstrap {

/** @var LoggerInterface */
protected $logger;

Expand Down
21 changes: 10 additions & 11 deletions apps/admin_audit/lib/AuditLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
*/
class AuditLogger implements IAuditLogger {

/** @var LoggerInterface */
private $parentLogger;
private LoggerInterface $parentLogger;

public function __construct(ILogFactory $logFactory, IConfig $config) {
$auditType = $config->getSystemValueString('log_type_audit', 'file');
Expand All @@ -50,39 +49,39 @@ public function __construct(ILogFactory $logFactory, IConfig $config) {
$this->parentLogger = $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag);
}

public function emergency($message, array $context = array()) {
public function emergency($message, array $context = array()): void {
$this->parentLogger->emergency($message, $context);
}

public function alert($message, array $context = array()) {
public function alert($message, array $context = array()): void {
$this->parentLogger->alert($message, $context);
}

public function critical($message, array $context = array()) {
public function critical($message, array $context = array()): void {
$this->parentLogger->critical($message, $context);
}

public function error($message, array $context = array()) {
public function error($message, array $context = array()): void {
$this->parentLogger->error($message, $context);
}

public function warning($message, array $context = array()) {
public function warning($message, array $context = array()): void {
$this->parentLogger->warning($message, $context);
}

public function notice($message, array $context = array()) {
public function notice($message, array $context = array()): void {
$this->parentLogger->notice($message, $context);
}

public function info($message, array $context = array()) {
public function info($message, array $context = array()): void {
$this->parentLogger->info($message, $context);
}

public function debug($message, array $context = array()) {
public function debug($message, array $context = array()): void {
$this->parentLogger->debug($message, $context);
}

public function log($level, $message, array $context = array()) {
public function log($level, $message, array $context = array()): void {
$this->parentLogger->log($level, $message, $context);
}
}
10 changes: 4 additions & 6 deletions apps/admin_audit/tests/Actions/SecurityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
use OCA\AdminAudit\AuditLogger;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

class SecurityTest extends TestCase {
/** @var AuditLogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
private AuditLogger|MockObject $logger;

/** @var Security */
private $security;
private Security $security;

/** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
private $user;
private MockObject|IUser $user;

protected function setUp(): void {
parent::setUp();
Expand Down
Loading