mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-20 16:16:37 +02:00
More type hints on some handler classes
This commit is contained in:
@@ -33,10 +33,10 @@ class AmqpHandler extends AbstractProcessingHandler
|
||||
/**
|
||||
* @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
|
||||
* @param string $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only
|
||||
* @param int $level
|
||||
* @param string|int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct($exchange, $exchangeName = null, $level = Logger::DEBUG, bool $bubble = true)
|
||||
public function __construct($exchange, ?string $exchangeName = null, $level = Logger::DEBUG, bool $bubble = true)
|
||||
{
|
||||
if ($exchange instanceof AMQPChannel) {
|
||||
$this->exchangeName = $exchangeName;
|
||||
@@ -108,25 +108,18 @@ class AmqpHandler extends AbstractProcessingHandler
|
||||
|
||||
/**
|
||||
* Gets the routing key for the AMQP exchange
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
*/
|
||||
protected function getRoutingKey(array $record)
|
||||
protected function getRoutingKey(array $record): string
|
||||
{
|
||||
$routingKey = sprintf('%s.%s', $record['level_name'], $record['channel']);
|
||||
|
||||
return strtolower($routingKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @return AMQPMessage
|
||||
*/
|
||||
private function createAmqpMessage($data)
|
||||
private function createAmqpMessage(string $data): AMQPMessage
|
||||
{
|
||||
return new AMQPMessage(
|
||||
(string) $data,
|
||||
$data,
|
||||
[
|
||||
'delivery_mode' => 2,
|
||||
'content_type' => 'application/json',
|
||||
|
Reference in New Issue
Block a user