assert phpstan rules
Cette révision appartient à :
Parent
d0a906c403
révision
5b18f7314e
@ -51,6 +51,12 @@ class LoggerFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $loggerName
|
||||
* @param string $filePath
|
||||
* @param int $logLevel
|
||||
* @param int|null $maxFiles
|
||||
* @param array<int|string, string|array<string, string>> $specialHandlers
|
||||
* @return Logger
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFileLogger(
|
||||
@ -79,11 +85,19 @@ class LoggerFactory
|
||||
?int $maxFiles = null
|
||||
): AbstractProcessingHandler {
|
||||
return is_null($maxFiles) ?
|
||||
/** @phpstan-ignore argument.type */
|
||||
new StreamHandler($filePath, $logLevel) :
|
||||
/** @phpstan-ignore argument.type */
|
||||
new RotatingFileHandler($filePath, $maxFiles, $logLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $loggerName
|
||||
* @param string $filePath
|
||||
* @param int $logLevel
|
||||
* @param int|null $maxFiles
|
||||
* @param array<int|string, string|array<string, string>> $specialHandlers
|
||||
* @return Logger
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getCombinedOxidAndFileLogger(
|
||||
@ -123,6 +137,11 @@ class LoggerFactory
|
||||
return OX_BASE_PATH . '/log' . DIRECTORY_SEPARATOR . $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractProcessingHandler $handler
|
||||
* @param array<int|string, string|array<string, string|int>> $specialHandlers
|
||||
* @return HandlerInterface
|
||||
*/
|
||||
public function applySpecialHandlers(
|
||||
AbstractProcessingHandler $handler,
|
||||
array $specialHandlers = []
|
||||
@ -133,7 +152,9 @@ class LoggerFactory
|
||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_BUFFERING];
|
||||
$handler = $this->setBuffering(
|
||||
$handler,
|
||||
/** @phpstan-ignore argument.type */
|
||||
$options[self::BUFFERING_OPTION_LIMIT] ?? 0,
|
||||
/** @phpstan-ignore argument.type */
|
||||
$options[self::BUFFERING_OPTION_LEVEL] ?? Logger::DEBUG
|
||||
);
|
||||
}
|
||||
@ -144,17 +165,22 @@ class LoggerFactory
|
||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_LOG_ON_ERROR_ONLY];
|
||||
$handler = $this->setLogItemsOnErrorOnly(
|
||||
$handler,
|
||||
/** @phpstan-ignore argument.type */
|
||||
$options[self::LOGONERRORONLY_LEVEL] ?? Logger::ERROR
|
||||
);
|
||||
}
|
||||
|
||||
if (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, $specialHandlers, true)) {
|
||||
/** @phpstan-ignore argument.type */
|
||||
$handler = $this->makeUnique($handler);
|
||||
} elseif (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, array_keys($specialHandlers), true)) {
|
||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_MAKE_UNIQUE];
|
||||
$handler = $this->makeUnique(
|
||||
/** @phpstan-ignore argument.type */
|
||||
$handler,
|
||||
/** @phpstan-ignore argument.type */
|
||||
$options[self::MAKEUNIQUE_OPTION_LEVEL] ?? Logger::ERROR,
|
||||
/** @phpstan-ignore argument.type */
|
||||
$options[self::MAKEUNIQUE_OPTION_TIME] ?? 60
|
||||
);
|
||||
}
|
||||
@ -167,6 +193,7 @@ class LoggerFactory
|
||||
int $bufferLimit = 0,
|
||||
int $loglevel = Logger::DEBUG
|
||||
): BufferHandler {
|
||||
/** @phpstan-ignore argument.type */
|
||||
return new BufferHandler($handler, $bufferLimit, $loglevel);
|
||||
}
|
||||
|
||||
@ -176,6 +203,7 @@ class LoggerFactory
|
||||
): FingersCrossedHandler {
|
||||
return new FingersCrossedHandler(
|
||||
$handler,
|
||||
/** @phpstan-ignore argument.type */
|
||||
new ErrorLevelActivationStrategy($activationLevel)
|
||||
);
|
||||
}
|
||||
@ -185,6 +213,7 @@ class LoggerFactory
|
||||
int $deduplicationLevel = Logger::ERROR,
|
||||
int $time = 60
|
||||
): DeduplicationHandler {
|
||||
/** @phpstan-ignore argument.type */
|
||||
return new DeduplicationHandler($handler, null, $deduplicationLevel, $time);
|
||||
}
|
||||
}
|
||||
|
Chargement…
x
Référencer dans un nouveau ticket
Bloquer un utilisateur