Skip to content

Commit

Permalink
upgrade to PHP 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mimmi20 committed Dec 3, 2024
1 parent 84d7024 commit cce3dbd
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 61 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
validate:
name: "Validate Project"

uses: "mimmi20/ci/.github/workflows/validate.yml@8.1"
uses: "mimmi20/ci/.github/workflows/validate.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -37,7 +37,7 @@ jobs:

needs: "validate"

uses: "mimmi20/ci/.github/workflows/install.yml@8.1"
uses: "mimmi20/ci/.github/workflows/install.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -50,7 +50,7 @@ jobs:

needs: "install"

uses: "mimmi20/ci/.github/workflows/analytics.yml@8.1"
uses: "mimmi20/ci/.github/workflows/analytics.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -59,7 +59,7 @@ jobs:
skip-phpcs: false
skip-phpstan: false
skip-rector: false
skip-phpmd: false
skip-phpmd: true
skip-eslint: true
skip-stylelint: true
skip-prettier: true
Expand All @@ -70,7 +70,7 @@ jobs:

needs: "analytics"

uses: "mimmi20/ci/.github/workflows/test.yml@8.1"
uses: "mimmi20/ci/.github/workflows/test.yml@8.3"
with:
extensions: "ctype, dom, fileinfo, intl, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand Down
6 changes: 4 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

declare(strict_types = 1);

$header = <<<'EOF'
$year = date('Y');

$header = <<<EOF
This file is part of the mimmi20/monolog-streamformatter package.
Copyright (c) 2022-2024, Thomas Mueller <[email protected]>
Copyright (c) 2022-{$year}, Thomas Mueller <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Expand Down
8 changes: 4 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 || 8.5.0",
"php": "~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 @@ -33,16 +33,16 @@
"infection/infection": "^0.29.8",
"laminas/laminas-modulemanager": "^2.17.0",
"laminas/laminas-servicemanager": "^3.22.1",
"mimmi20/coding-standard": "^5.2.45",
"mimmi20/coding-standard": "^6.0.0",
"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",
"phpunit/phpunit": "^11.4.4",
"rector/rector": "^1.2.10",
"rector/type-perfect": "^1.0.0",
"symfony/process": "^6.4.15",
"symfony/process": "^7.2.0",
"symplify/phpstan-rules": "^13.0.1",
"tomasvotruba/cognitive-complexity": "^0.2.3",
"tomasvotruba/type-coverage": "^1.0.0",
Expand Down
36 changes: 0 additions & 36 deletions phpmd.ruleset.xml

This file was deleted.

4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
level: max

phpVersion: 80100 # PHP 8.1
phpVersion: 80300 # PHP 8.3

parallel:
maximumNumberOfProcesses: 1
Expand Down Expand Up @@ -104,7 +104,7 @@ parameters:
return_type: 100
param_type: 98.4
property_type: 100
constant_type: 0
constant_type: 100
# also, how many files has declare strict types
declare: 100

Expand Down
4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnIncompleteTests="true"
failOnPhpunitDeprecation="true"
failOnEmptyTestSuite="true"
failOnIncomplete="true"
failOnRisky="true"
Expand Down Expand Up @@ -51,7 +53,7 @@
</testsuite>
</testsuites>

<coverage includeUncoveredFiles="true">
<coverage>
<report>
<clover outputFile=".reports/clover.xml"/>
<html outputDirectory=".reports/report/" lowUpperBound="50" highLowerBound="80"/>
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_83,
PHPUnitSetList::PHPUNIT_100,
]);

Expand Down
2 changes: 2 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20\Monolog\Formatter;

use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Override;

final class Module implements ConfigProviderInterface
{
Expand All @@ -25,6 +26,7 @@ final class Module implements ConfigProviderInterface
*
* @throws void
*/
#[Override]
public function getConfig(): array
{
$provider = new ConfigProvider();
Expand Down
19 changes: 11 additions & 8 deletions src/StreamFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Level;
use Monolog\LogRecord;
use Override;
use RuntimeException;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
Expand All @@ -37,28 +38,28 @@
final class StreamFormatter extends NormalizerFormatter
{
/** @api */
public const SIMPLE_FORMAT = '%message%';
public const string SIMPLE_FORMAT = '%message%';

/** @api */
public const BOX_STYLE = 'box';
public const string BOX_STYLE = 'box';

/** @api */
public const WIDTH_FIRST_COLUMN = 20;
public const int WIDTH_FIRST_COLUMN = 20;

/** @api */
public const WIDTH_SECOND_COLUMN = 20;
public const int WIDTH_SECOND_COLUMN = 20;

/** @api */
public const WIDTH_THIRD_COLUMN = 220;
public const int WIDTH_THIRD_COLUMN = 220;

/** @api */
public const FULL_WIDTH = self::WIDTH_FIRST_COLUMN + self::WIDTH_SECOND_COLUMN + self::WIDTH_THIRD_COLUMN + 10;
public const int FULL_WIDTH = self::WIDTH_FIRST_COLUMN + self::WIDTH_SECOND_COLUMN + self::WIDTH_THIRD_COLUMN + 10;

/** @api */
public const SPAN_ALL_COLUMS = 3;
public const int SPAN_ALL_COLUMS = 3;

/** @api */
public const SPAN_LAST_COLUMNS = 2;
public const int SPAN_LAST_COLUMNS = 2;

private readonly string $format;
private bool $allowInlineLineBreaks;
Expand Down Expand Up @@ -141,6 +142,7 @@ public function setFormatter(LineFormatter $formatter): void
*
* @throws RuntimeException if encoding fails and errors are not ignored
*/
#[Override]
public function format(LogRecord $record): string
{
$message = $this->getFormatter()->format($record);
Expand Down Expand Up @@ -199,6 +201,7 @@ public function format(LogRecord $record): string
*
* @throws RuntimeException if encoding fails and errors are not ignored
*/
#[Override]
public function formatBatch(array $records): string
{
$message = '';
Expand Down
6 changes: 4 additions & 2 deletions src/StreamFormatterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20\Monolog\Formatter;

use Laminas\ServiceManager\Factory\FactoryInterface;
use Override;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\BufferedOutput;
Expand All @@ -24,10 +25,10 @@
final class StreamFormatterFactory implements FactoryInterface
{
/** @api */
public const DEFAULT_NORMALIZER_DEPTH = 9;
public const int DEFAULT_NORMALIZER_DEPTH = 9;

/** @api */
public const DEFAULT_NORMALIZER_ITEM_COUNT = 1000;
public const int DEFAULT_NORMALIZER_ITEM_COUNT = 1000;

/**
* @param string $requestedName
Expand All @@ -39,6 +40,7 @@ final class StreamFormatterFactory implements FactoryInterface
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
*/
#[Override]
public function __invoke(
ContainerInterface $container,
$requestedName,
Expand Down
2 changes: 2 additions & 0 deletions tests/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20Test\Monolog\Formatter;

use Mimmi20\Monolog\Formatter\ConfigProvider;
use Override;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\TestCase;

Expand All @@ -22,6 +23,7 @@ final class ConfigProviderTest extends TestCase
private ConfigProvider $provider;

/** @throws void */
#[Override]
protected function setUp(): void
{
$this->provider = new ConfigProvider();
Expand Down

0 comments on commit cce3dbd

Please sign in to comment.