This commit is contained in:
2020-12-17 14:09:14 +08:00
parent 672a719dbd
commit 36c1d0502a
151 changed files with 1937 additions and 2848 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ interface ConsumerInterface
* @param Struct $struct
* @return mixed
*/
public function onHandler(Struct $struct);
public function onHandler(Struct $struct): mixed;
}
+1 -1
View File
@@ -144,7 +144,7 @@ class Kafka extends \Snowflake\Process\Process
* @param $kafka
* @return array
*/
private function kafkaConfig($kafka)
private function kafkaConfig($kafka): array
{
$conf = new Conf();
$conf->setRebalanceCb([$this, 'rebalanced_cb']);
+15 -10
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Kafka;
use Exception;
use Psr\Log\LoggerInterface;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
@@ -17,10 +18,10 @@ class Logger implements LoggerInterface
/**
* @param string $message
* @param mixed $message
* @param array $context
*/
public function emergency($message, array $context = array())
public function emergency(mixed $message, array $context = array())
{
// TODO: Implement emergency() method.
var_dump(func_get_args());
@@ -30,14 +31,15 @@ class Logger implements LoggerInterface
* @param string $message
* @param array $context
* @throws ComponentException
* @throws Exception
*/
public function alert($message, array $context = array())
public function alert(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->debug($message);
}
public function critical($message, array $context = array())
public function critical(mixed $message, array $context = array())
{
// TODO: Implement critical() method.
var_dump(func_get_args());
@@ -47,8 +49,9 @@ class Logger implements LoggerInterface
* @param string $message
* @param array $context
* @throws ComponentException
* @throws Exception
*/
public function error($message, array $context = array())
public function error(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->error($message);
@@ -59,7 +62,7 @@ class Logger implements LoggerInterface
* @param array $context
* @throws ComponentException
*/
public function warning($message, array $context = array())
public function warning(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->warning($message);
@@ -70,7 +73,7 @@ class Logger implements LoggerInterface
* @param array $context
* @throws ComponentException
*/
public function notice($message, array $context = array())
public function notice(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->info($message);
@@ -81,7 +84,7 @@ class Logger implements LoggerInterface
* @param array $context
* @throws ComponentException
*/
public function info($message, array $context = array())
public function info(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->info($message);
@@ -91,8 +94,9 @@ class Logger implements LoggerInterface
* @param string $message
* @param array $context
* @throws ComponentException
* @throws Exception
*/
public function debug($message, array $context = array())
public function debug(mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->debug($message);
@@ -103,8 +107,9 @@ class Logger implements LoggerInterface
* @param $message
* @param array $context
* @throws ComponentException
* @throws Exception
*/
public function log($level, $message, array $context = array())
public function log($level, mixed $message, array $context = array())
{
$logger = Snowflake::app()->getLogger();
$logger->debug($message);
+2 -2
View File
@@ -51,7 +51,7 @@ class Producer extends Component
* @param $servers
* @return Producer
*/
public function setBrokers(string $servers)
public function setBrokers(string $servers): static
{
$this->conf->set('metadata.broker.list', $servers);
return $this;
@@ -62,7 +62,7 @@ class Producer extends Component
* @param $servers
* @return Producer
*/
public function setTopic(string $servers)
public function setTopic(string $servers): static
{
$this->_topic = $servers;
return $this;