Skip to content

Commit

Permalink
allow php 8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mimmi20 committed Nov 17, 2024
1 parent 527d84f commit 7528aa0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 60 deletions.
26 changes: 0 additions & 26 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,6 @@ updates:
include: "scope"
prefix: "composer"

ignore:
- dependency-name: "browscap/browscap"
- dependency-name: "elasticsearch/elasticsearch"
- dependency-name: "endorphin-studio/browser-detector-tests"
- dependency-name: "illuminate/config"
- dependency-name: "illuminate/container"
- dependency-name: "illuminate/contracts"
- dependency-name: "illuminate/events"
- dependency-name: "illuminate/filesystem"
- dependency-name: "illuminate/view"
- dependency-name: "infection/infection"
- dependency-name: "laminas/laminas-diactoros"
- dependency-name: "laminas/laminas-servicemanager"
- dependency-name: "nikic/php-parser"
- dependency-name: "phpunit/phpunit"
- dependency-name: "predis/predis"
- dependency-name: "psr/container"
- dependency-name: "psr/http-message"
- dependency-name: "psr/log"
- dependency-name: "psr/simple-cache"
- dependency-name: "symfony/console"
- dependency-name: "symfony/filesystem"
- dependency-name: "symfony/finder"
- dependency-name: "symfony/http-foundation"
- dependency-name: "symfony/yaml"

rebase-strategy: "auto"

- package-ecosystem: "github-actions"
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"source": "https://github.com/mimmi20/monolog-streamformatter"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || 8.5.0",
"ext-mbstring": "*",
"monolog/monolog": "^3.8.0",
"psr/container": "^1.1.2 || ^2.0.2",
Expand All @@ -30,18 +30,19 @@
"ext-tokenizer": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"infection/infection": "^0.27.11 || ^0.28.1",
"infection/infection": "^0.29.8",
"laminas/laminas-modulemanager": "^2.16.0",
"laminas/laminas-servicemanager": "^3.22.1 || ^4.0.0",
"laminas/laminas-servicemanager": "^3.22.1",
"mimmi20/coding-standard": "^5.2.44",
"nikic/php-parser": "^4.19.1 || ^5.0.2",
"nikic/php-parser": "^5.3.1",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^1.12.9",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpstan/phpstan-phpunit": "^1.4.0",
"phpunit/phpunit": "^10.5.25",
"rector/rector": "^1.2.10",
"rector/type-perfect": "^1.0.0",
"symfony/process": "^6.4.15",
"symplify/phpstan-rules": "^13.0.1",
"tomasvotruba/cognitive-complexity": "^0.2.3",
"tomasvotruba/type-coverage": "^1.0.0",
Expand Down
9 changes: 6 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
parameters:
level: max

phpVersion: 80100 # PHP 8.1

parallel:
maximumNumberOfProcesses: 1
processTimeout: 200.0
Expand Down Expand Up @@ -99,9 +101,10 @@ parameters:
function: 24

type_coverage:
return: 100
param: 98.4
property: 100
return_type: 100
param_type: 98.4
property_type: 100
constant_type: 0
# also, how many files has declare strict types
declare: 100

Expand Down
4 changes: 2 additions & 2 deletions src/StreamFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class StreamFormatter extends NormalizerFormatter
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
* @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries
*
* @throws RuntimeException
* @throws void
*/
public function __construct(
private readonly BufferedOutput $output,
Expand Down Expand Up @@ -209,7 +209,7 @@ public function formatBatch(array $records): string
return $message;
}

/** @throws RuntimeException */
/** @throws void */
private function getFormatter(): LineFormatter
{
if ($this->formatter === null) {
Expand Down
31 changes: 10 additions & 21 deletions src/StreamFormatterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@

namespace Mimmi20\Monolog\Formatter;

use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
use RuntimeException;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\BufferedOutput;

use function array_key_exists;
use function is_array;
use function sprintf;

final class StreamFormatterFactory implements FactoryInterface
{
Expand All @@ -36,7 +33,7 @@ final class StreamFormatterFactory implements FactoryInterface
* @param array<string, (bool|int|string)>|null $options
* @phpstan-param array{format?: string, tableStyle?: string, dateFormat?: string, allowInlineLineBreaks?: bool, includeStacktraces?: bool, maxNormalizeDepth?: int, maxNormalizeItemCount?: int, prettyPrint?: bool}|null $options
*
* @throws ServiceNotCreatedException
* @throws void
*
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
Expand Down Expand Up @@ -91,23 +88,15 @@ public function __invoke(

$output = new BufferedOutput();

try {
$formatter = new StreamFormatter(
$output,
new Table($output),
$format,
$tableStyle,
$dateFormat,
$allowInlineLineBreaks,
$includeStacktraces,
);
} catch (RuntimeException $e) {
throw new ServiceNotCreatedException(
sprintf('Could not create %s', StreamFormatter::class),
0,
$e,
);
}
$formatter = new StreamFormatter(
$output,
new Table($output),
$format,
$tableStyle,
$dateFormat,
$allowInlineLineBreaks,
$includeStacktraces,
);

$formatter->setMaxNormalizeDepth($maxNormalizeDepth);
$formatter->setMaxNormalizeItemCount($maxNormalizeItemCount);
Expand Down
4 changes: 0 additions & 4 deletions tests/StreamFormatterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Mimmi20Test\Monolog\Formatter;

use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Mimmi20\Monolog\Formatter\StreamFormatter;
use Mimmi20\Monolog\Formatter\StreamFormatterFactory;
use Monolog\Formatter\NormalizerFormatter;
Expand All @@ -29,7 +28,6 @@ final class StreamFormatterFactoryTest extends TestCase
/**
* @throws Exception
* @throws ReflectionException
* @throws ServiceNotCreatedException
*/
public function testInvokeWithoutConfig(): void
{
Expand Down Expand Up @@ -95,7 +93,6 @@ public function testInvokeWithoutConfig(): void
/**
* @throws Exception
* @throws ReflectionException
* @throws ServiceNotCreatedException
*/
public function testInvokeWithEmptyConfig(): void
{
Expand Down Expand Up @@ -161,7 +158,6 @@ public function testInvokeWithEmptyConfig(): void
/**
* @throws Exception
* @throws ReflectionException
* @throws ServiceNotCreatedException
*/
public function testInvokeWithConfig(): void
{
Expand Down

0 comments on commit 7528aa0

Please sign in to comment.