mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-16 18:14:02 +02:00
Move phpdoc to native types
This commit is contained in:
@@ -24,12 +24,12 @@ class ElasticaHandlerTest extends TestCase
|
||||
/**
|
||||
* @var Client mock
|
||||
*/
|
||||
protected $client;
|
||||
protected Client $client;
|
||||
|
||||
/**
|
||||
* @var array Default handler options
|
||||
*/
|
||||
protected $options = [
|
||||
protected array $options = [
|
||||
'index' => 'my_index',
|
||||
'type' => 'doc_type',
|
||||
];
|
||||
@@ -136,10 +136,7 @@ class ElasticaHandlerTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerTestConnectionErrors()
|
||||
public function providerTestConnectionErrors(): array
|
||||
{
|
||||
return [
|
||||
[false, ['RuntimeException', 'Error sending messages to Elasticsearch']],
|
||||
@@ -241,10 +238,9 @@ class ElasticaHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Return last created document id from ES response
|
||||
* @param Response $response Elastica Response object
|
||||
* @return string|null
|
||||
* @param Response $response Elastica Response object
|
||||
*/
|
||||
protected function getCreatedDocId(Response $response)
|
||||
protected function getCreatedDocId(Response $response): ?string
|
||||
{
|
||||
$data = $response->getData();
|
||||
if (!empty($data['items'][0]['create']['_id'])) {
|
||||
@@ -254,13 +250,10 @@ class ElasticaHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Retrieve document by id from Elasticsearch
|
||||
* @param Client $client Elastica client
|
||||
* @param string $index
|
||||
* @param ?string $type
|
||||
* @param string $documentId
|
||||
* @return array
|
||||
* @param Client $client Elastica client
|
||||
* @param ?string $type
|
||||
*/
|
||||
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
|
||||
protected function getDocSourceFromElastic(Client $client, string $index, $type, string $documentId): array
|
||||
{
|
||||
if ($type === null) {
|
||||
$path = "/{$index}/_doc/{$documentId}";
|
||||
|
@@ -23,12 +23,12 @@ class ElasticsearchHandlerTest extends TestCase
|
||||
/**
|
||||
* @var Client mock
|
||||
*/
|
||||
protected $client;
|
||||
protected Client $client;
|
||||
|
||||
/**
|
||||
* @var array Default handler options
|
||||
*/
|
||||
protected $options = [
|
||||
protected array $options = [
|
||||
'index' => 'my_index',
|
||||
'type' => 'doc_type',
|
||||
];
|
||||
@@ -151,10 +151,7 @@ class ElasticsearchHandlerTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function providerTestConnectionErrors()
|
||||
public function providerTestConnectionErrors(): array
|
||||
{
|
||||
return [
|
||||
[false, ['RuntimeException', 'Error sending messages to Elasticsearch']],
|
||||
@@ -215,10 +212,9 @@ class ElasticsearchHandlerTest extends TestCase
|
||||
/**
|
||||
* Return last created document id from ES response
|
||||
*
|
||||
* @param array $info Elasticsearch last request info
|
||||
* @return string|null
|
||||
* @param array $info Elasticsearch last request info
|
||||
*/
|
||||
protected function getCreatedDocId(array $info)
|
||||
protected function getCreatedDocId(array $info): ?string
|
||||
{
|
||||
$data = json_decode($info['response']['body'], true);
|
||||
|
||||
@@ -230,13 +226,9 @@ class ElasticsearchHandlerTest extends TestCase
|
||||
/**
|
||||
* Retrieve document by id from Elasticsearch
|
||||
*
|
||||
* @param Client $client Elasticsearch client
|
||||
* @param string $index
|
||||
* @param string $type
|
||||
* @param string $documentId
|
||||
* @return array
|
||||
* @param Client $client Elasticsearch client
|
||||
*/
|
||||
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
|
||||
protected function getDocSourceFromElastic(Client $client, string $index, string $type, string $documentId): array
|
||||
{
|
||||
$params = [
|
||||
'index' => $index,
|
||||
|
@@ -17,7 +17,7 @@ use Monolog\LogRecord;
|
||||
class ExceptionTestHandler extends TestHandler
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function handle(LogRecord $record): bool
|
||||
{
|
||||
|
@@ -25,10 +25,7 @@ class FleepHookHandlerTest extends TestCase
|
||||
*/
|
||||
const TOKEN = '123abc';
|
||||
|
||||
/**
|
||||
* @var FleepHookHandler
|
||||
*/
|
||||
private $handler;
|
||||
private FleepHookHandler $handler;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
|
@@ -26,10 +26,7 @@ class FlowdockHandlerTest extends TestCase
|
||||
*/
|
||||
private $res;
|
||||
|
||||
/**
|
||||
* @var FlowdockHandler
|
||||
*/
|
||||
private $handler;
|
||||
private FlowdockHandler $handler;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
|
@@ -18,10 +18,7 @@ use Monolog\Test\TestCase;
|
||||
*/
|
||||
class HandlerWrapperTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var HandlerWrapper
|
||||
*/
|
||||
private $wrapper;
|
||||
private HandlerWrapper $wrapper;
|
||||
|
||||
private $handler;
|
||||
|
||||
@@ -32,10 +29,7 @@ class HandlerWrapperTest extends TestCase
|
||||
$this->wrapper = new HandlerWrapper($this->handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function trueFalseDataProvider()
|
||||
public function trueFalseDataProvider(): array
|
||||
{
|
||||
return [
|
||||
[true],
|
||||
|
@@ -13,6 +13,7 @@ namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Level;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
* @author Robert Kaufmann III <rok3@rok3.me>
|
||||
@@ -25,10 +26,7 @@ class InsightOpsHandlerTest extends TestCase
|
||||
*/
|
||||
private $resource;
|
||||
|
||||
/**
|
||||
* @var LogEntriesHandler
|
||||
*/
|
||||
private $handler;
|
||||
private InsightOpsHandler&MockObject $handler;
|
||||
|
||||
public function testWriteContent()
|
||||
{
|
||||
|
@@ -13,6 +13,7 @@ namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Level;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
* @author Robert Kaufmann III <rok3@rok3.me>
|
||||
@@ -24,10 +25,7 @@ class LogEntriesHandlerTest extends TestCase
|
||||
*/
|
||||
private $res;
|
||||
|
||||
/**
|
||||
* @var LogEntriesHandler
|
||||
*/
|
||||
private $handler;
|
||||
private LogEntriesHandler&MockObject $handler;
|
||||
|
||||
public function testWriteContent()
|
||||
{
|
||||
|
@@ -13,6 +13,7 @@ namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Level;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
* @author Julien Breux <julien.breux@gmail.com>
|
||||
@@ -24,10 +25,7 @@ class LogmaticHandlerTest extends TestCase
|
||||
*/
|
||||
private $res;
|
||||
|
||||
/**
|
||||
* @var LogmaticHandler
|
||||
*/
|
||||
private $handler;
|
||||
private LogmaticHandler&MockObject $handler;
|
||||
|
||||
public function testWriteContent()
|
||||
{
|
||||
|
@@ -57,10 +57,8 @@ class ProcessHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Data provider for invalid commands.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalidCommandProvider()
|
||||
public function invalidCommandProvider(): array
|
||||
{
|
||||
return [
|
||||
[1337, 'TypeError'],
|
||||
@@ -83,10 +81,8 @@ class ProcessHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Data provider for invalid CWDs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalidCwdProvider()
|
||||
public function invalidCwdProvider(): array
|
||||
{
|
||||
return [
|
||||
[1337, 'TypeError'],
|
||||
|
@@ -27,15 +27,9 @@ use Rollbar\RollbarLogger;
|
||||
*/
|
||||
class RollbarHandlerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MockObject
|
||||
*/
|
||||
private $rollbarLogger;
|
||||
private RollbarLogger&MockObject $rollbarLogger;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $reportedExceptionArguments = null;
|
||||
private array $reportedExceptionArguments;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -65,10 +65,7 @@ class SlackRecordTest extends TestCase
|
||||
$this->assertArrayNotHasKey('username', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function dataStringify()
|
||||
public function dataStringify(): array
|
||||
{
|
||||
$multipleDimensions = [[1, 2]];
|
||||
$numericKeys = ['library' => 'monolog'];
|
||||
|
@@ -27,10 +27,7 @@ class SlackHandlerTest extends TestCase
|
||||
*/
|
||||
private $res;
|
||||
|
||||
/**
|
||||
* @var SlackHandler
|
||||
*/
|
||||
private $handler;
|
||||
private SlackHandler $handler;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
|
@@ -261,9 +261,8 @@ STRING;
|
||||
|
||||
/**
|
||||
* @dataProvider provideMemoryValues
|
||||
* @return void
|
||||
*/
|
||||
public function testPreventOOMError($phpMemory, $expectedChunkSize)
|
||||
public function testPreventOOMError($phpMemory, $expectedChunkSize): void
|
||||
{
|
||||
$previousValue = ini_set('memory_limit', $phpMemory);
|
||||
|
||||
@@ -287,10 +286,7 @@ STRING;
|
||||
$this->assertEquals($expectedChunkSize, $handler->getStreamChunkSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testSimpleOOMPrevention()
|
||||
public function testSimpleOOMPrevention(): void
|
||||
{
|
||||
$previousValue = ini_set('memory_limit', '2048M');
|
||||
|
||||
|
@@ -13,6 +13,7 @@ namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Level;
|
||||
use Monolog\Test\TestCase;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
* @author Mazur Alexandr <alexandrmazur96@gmail.com>
|
||||
@@ -20,10 +21,7 @@ use Monolog\Test\TestCase;
|
||||
*/
|
||||
class TelegramBotHandlerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var TelegramBotHandler
|
||||
*/
|
||||
private $handler;
|
||||
private TelegramBotHandler&MockObject $handler;
|
||||
|
||||
public function testSendTelegramRequest(): void
|
||||
{
|
||||
@@ -31,8 +29,6 @@ class TelegramBotHandlerTest extends TestCase
|
||||
$this->handler->handle($this->getRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
private function createHandler(
|
||||
string $apiKey = 'testKey',
|
||||
string $channel = 'testChannel',
|
||||
|
Reference in New Issue
Block a user