assert phpstan rules
This commit is contained in:
parent
d0a906c403
commit
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
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getFileLogger(
|
public function getFileLogger(
|
||||||
@ -79,11 +85,19 @@ class LoggerFactory
|
|||||||
?int $maxFiles = null
|
?int $maxFiles = null
|
||||||
): AbstractProcessingHandler {
|
): AbstractProcessingHandler {
|
||||||
return is_null($maxFiles) ?
|
return is_null($maxFiles) ?
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
new StreamHandler($filePath, $logLevel) :
|
new StreamHandler($filePath, $logLevel) :
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
new RotatingFileHandler($filePath, $maxFiles, $logLevel);
|
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
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCombinedOxidAndFileLogger(
|
public function getCombinedOxidAndFileLogger(
|
||||||
@ -123,6 +137,11 @@ class LoggerFactory
|
|||||||
return OX_BASE_PATH . '/log' . DIRECTORY_SEPARATOR . $fileName;
|
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(
|
public function applySpecialHandlers(
|
||||||
AbstractProcessingHandler $handler,
|
AbstractProcessingHandler $handler,
|
||||||
array $specialHandlers = []
|
array $specialHandlers = []
|
||||||
@ -133,7 +152,9 @@ class LoggerFactory
|
|||||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_BUFFERING];
|
$options = $specialHandlers[self::SPECIAL_HANDLERS_BUFFERING];
|
||||||
$handler = $this->setBuffering(
|
$handler = $this->setBuffering(
|
||||||
$handler,
|
$handler,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$options[self::BUFFERING_OPTION_LIMIT] ?? 0,
|
$options[self::BUFFERING_OPTION_LIMIT] ?? 0,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$options[self::BUFFERING_OPTION_LEVEL] ?? Logger::DEBUG
|
$options[self::BUFFERING_OPTION_LEVEL] ?? Logger::DEBUG
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -144,17 +165,22 @@ class LoggerFactory
|
|||||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_LOG_ON_ERROR_ONLY];
|
$options = $specialHandlers[self::SPECIAL_HANDLERS_LOG_ON_ERROR_ONLY];
|
||||||
$handler = $this->setLogItemsOnErrorOnly(
|
$handler = $this->setLogItemsOnErrorOnly(
|
||||||
$handler,
|
$handler,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$options[self::LOGONERRORONLY_LEVEL] ?? Logger::ERROR
|
$options[self::LOGONERRORONLY_LEVEL] ?? Logger::ERROR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, $specialHandlers, true)) {
|
if (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, $specialHandlers, true)) {
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$handler = $this->makeUnique($handler);
|
$handler = $this->makeUnique($handler);
|
||||||
} elseif (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, array_keys($specialHandlers), true)) {
|
} elseif (in_array(self::SPECIAL_HANDLERS_MAKE_UNIQUE, array_keys($specialHandlers), true)) {
|
||||||
$options = $specialHandlers[self::SPECIAL_HANDLERS_MAKE_UNIQUE];
|
$options = $specialHandlers[self::SPECIAL_HANDLERS_MAKE_UNIQUE];
|
||||||
$handler = $this->makeUnique(
|
$handler = $this->makeUnique(
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$handler,
|
$handler,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$options[self::MAKEUNIQUE_OPTION_LEVEL] ?? Logger::ERROR,
|
$options[self::MAKEUNIQUE_OPTION_LEVEL] ?? Logger::ERROR,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
$options[self::MAKEUNIQUE_OPTION_TIME] ?? 60
|
$options[self::MAKEUNIQUE_OPTION_TIME] ?? 60
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -167,6 +193,7 @@ class LoggerFactory
|
|||||||
int $bufferLimit = 0,
|
int $bufferLimit = 0,
|
||||||
int $loglevel = Logger::DEBUG
|
int $loglevel = Logger::DEBUG
|
||||||
): BufferHandler {
|
): BufferHandler {
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
return new BufferHandler($handler, $bufferLimit, $loglevel);
|
return new BufferHandler($handler, $bufferLimit, $loglevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +203,7 @@ class LoggerFactory
|
|||||||
): FingersCrossedHandler {
|
): FingersCrossedHandler {
|
||||||
return new FingersCrossedHandler(
|
return new FingersCrossedHandler(
|
||||||
$handler,
|
$handler,
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
new ErrorLevelActivationStrategy($activationLevel)
|
new ErrorLevelActivationStrategy($activationLevel)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -185,6 +213,7 @@ class LoggerFactory
|
|||||||
int $deduplicationLevel = Logger::ERROR,
|
int $deduplicationLevel = Logger::ERROR,
|
||||||
int $time = 60
|
int $time = 60
|
||||||
): DeduplicationHandler {
|
): DeduplicationHandler {
|
||||||
|
/** @phpstan-ignore argument.type */
|
||||||
return new DeduplicationHandler($handler, null, $deduplicationLevel, $time);
|
return new DeduplicationHandler($handler, null, $deduplicationLevel, $time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user