Skip to content

Commit 95ccb7f

Browse files
committed
Update PHP minimum version to 8.0 and dependencies to latest compatible version
1 parent 518d451 commit 95ccb7f

15 files changed

+38
-46
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
16-
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
16+
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4']
1717
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
1818
steps:
1919
- name: Checkout
@@ -28,7 +28,7 @@ jobs:
2828
run: php -v
2929
- name: Cache Composer packages
3030
id: composer-cache
31-
uses: actions/cache@v3
31+
uses: actions/cache@v4
3232
with:
3333
path: vendor
3434
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build:
1111
command: phpcs-run
1212
use_website_config: false
1313
environment:
14-
php: 7.4.0
14+
php: 8.0
1515
filter:
1616
excluded_paths:
1717
- 'tests/*'

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/6d3b0f1709f94656a064f60c0bc893a9)](https://app.codacy.com/gh/platine-php/logger/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
1313

1414
### Requirements
15-
- **PHP >= 7.4**, **PHP 8**
15+
- **PHP >= 8.0**
1616

1717
### Installation
1818
#### Using composer (recommended)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
},
2020

2121
"require": {
22-
"php": "^7.4 || ^8",
22+
"php": "^8",
2323
"platine-php/stdlib": "^1.0"
2424
},
2525

2626
"require-dev": {
2727
"mikey179/vfsstream": "~1.6",
2828
"phpmd/phpmd": "@stable",
29-
"phpstan/phpstan": "^1.8",
30-
"phpunit/phpunit": "^9.5",
31-
"platine-php/dev": "^1.0",
29+
"phpstan/phpstan": "^2.0",
30+
"phpunit/phpunit": "^9.6",
31+
"platine-php/dev": "^2.0",
3232
"squizlabs/php_codesniffer": "3.*"
3333
},
3434

src/Configuration.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
use Platine\Stdlib\Config\AbstractConfiguration;
5050

5151
/**
52-
* Class Configuration
52+
* @class Configuration
5353
* @package Platine\Logger
5454
*/
5555
class Configuration extends AbstractConfiguration
@@ -79,19 +79,19 @@ public function getValidationRules(): array
7979
public function getDefault(): array
8080
{
8181
return [
82-
'level' => LogLevel::DEBUG,
83-
'driver' => 'null',
84-
'timestamp' => false,
85-
'handlers' => [
86-
'file' => [
87-
'path' => 'logs',
88-
'prefix' => 'app.',
89-
'ip_addr' => false,
90-
'level' => LogLevel::DEBUG,
91-
],
92-
'null' => []
82+
'level' => LogLevel::DEBUG,
83+
'driver' => 'null',
84+
'timestamp' => false,
85+
'handlers' => [
86+
'file' => [
87+
'path' => 'logs',
88+
'prefix' => 'app.',
89+
'ip_addr' => false,
90+
'level' => LogLevel::DEBUG,
91+
],
92+
'null' => []
9393

94-
]
94+
]
9595
];
9696
}
9797
}

src/Formatter/AbstractFormatter.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
use Throwable;
5454

5555
/**
56-
* Class AbstractFormatter
56+
* @class AbstractFormatter
5757
* @package Platine\Logger\Formatter
5858
*/
5959
abstract class AbstractFormatter implements LoggerFormatterInterface
@@ -64,25 +64,18 @@ abstract class AbstractFormatter implements LoggerFormatterInterface
6464
*/
6565
protected string $tab = "\t";
6666

67-
/**
68-
* The configuration to use
69-
* @var Configuration
70-
*/
71-
protected Configuration $config;
72-
7367
/**
7468
* Create new instance
7569
* @param Configuration $config the configuration to use
7670
*/
77-
public function __construct(Configuration $config)
71+
public function __construct(protected Configuration $config)
7872
{
79-
$this->config = $config;
8073
}
8174

8275
/**
8376
* Get Exception information data
8477
* @param Throwable $exception
85-
* @return array<string, mixed> the exception data
78+
* @return array<string, mixed> the exception data
8679
*/
8780
protected function getExceptionData(Throwable $exception): array
8881
{
@@ -102,7 +95,7 @@ protected function getExceptionData(Throwable $exception): array
10295
$trace['file'] ?? '',
10396
$trace['class'] ?? '',
10497
$trace['type'] ?? '',
105-
$trace['function'] ?? '',
98+
$trace['function'],
10699
isset($trace['args']) ? '...' : '',
107100
$trace['line'] ?? ''
108101
) . "\n";
@@ -143,7 +136,7 @@ protected function interpolate(string $message, array $context): string
143136
protected function getLogTime(): string
144137
{
145138
$format = 'Y-m-d H:i:s.u';
146-
$useTimestamp = $this->config->get('timestamp', false);
139+
$useTimestamp = $this->config->get('timestamp');
147140
if ($useTimestamp === false) {
148141
$format = 'H:i:s.u';
149142
}

src/Formatter/DefaultFormatter.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
use Throwable;
5151

5252
/**
53-
* Class DefaultFormatter
53+
* @class DefaultFormatter
5454
* @package Platine\Logger\Formatter
5555
*/
5656
class DefaultFormatter extends AbstractFormatter
@@ -77,15 +77,14 @@ public function format(
7777

7878
$msg = $this->interpolate($message, $context);
7979
$logLevel = strtoupper($level);
80-
$useIp = $this->config->get('handlers.file.ip_addr', false);
80+
$useIp = $this->config->get('handlers.file.ip_addr');
8181
$ipStr = '';
8282
if ($useIp) {
8383
$ip = Str::ip();
8484
$ipStr = '[' . $ip . ']' . $this->tab;
8585
}
8686

87-
return
88-
$this->getLogTime() . $this->tab .
87+
return $this->getLogTime() . $this->tab .
8988
$ipStr .
9089
'[' . $logLevel . ']' . $this->tab .
9190
'[' . $channel . ']' . $this->tab .

src/Handler/AbstractLoggerHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
use Platine\Logger\LoggerHandlerInterface;
5151

5252
/**
53-
* Class AbstractLoggerHandler
53+
* @class AbstractLoggerHandler
5454
* @package Platine\Logger\Handler
5555
*/
5656
abstract class AbstractLoggerHandler implements LoggerHandlerInterface

src/Handler/FileHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
use Throwable;
5454

5555
/**
56-
* Class FileHandler
56+
* @class FileHandler
5757
* @package Platine\Logger\Handler
5858
*/
5959
class FileHandler extends AbstractLoggerHandler

src/Handler/NullHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
namespace Platine\Logger\Handler;
4848

4949
/**
50-
* Class NullHandler
50+
* @class NullHandler
5151
* @package Platine\Logger\Handler
5252
*/
5353
class NullHandler extends AbstractLoggerHandler

0 commit comments

Comments
 (0)