Skip to content

Commit 9631993

Browse files
committed
Merge branch 'develop'
* develop: specify next release use promoted properties fix tests on php 8.4 fix tests on php 8.4 update dependencies fix ci badge
2 parents 9a18c04 + 9783bc2 commit 9631993

15 files changed

Lines changed: 64 additions & 63 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ jobs:
1212
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
1313
cs:
1414
uses: innmind/github-workflows/.github/workflows/cs.yml@main
15-
with:
16-
php-version: '8.2'

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 6.0.0 - 2026-02-15
4+
5+
### Changed
6+
7+
- Requires PHP `8.4`
8+
- Requires `innmind/foundation:~2.1`
9+
310
## 5.4.0 - 2025-07-31
411

512
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Log reader
22

3-
[![Build Status](https://github.com/Innmind/LogReader/workflows/CI/badge.svg?branch=master)](https://github.com/Innmind/LogReader/actions?query=workflow%3ACI)
3+
[![CI](https://github.com/Innmind/LogReader/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/LogReader/actions/workflows/ci.yml)
44
[![codecov](https://codecov.io/gh/Innmind/LogReader/branch/develop/graph/badge.svg)](https://codecov.io/gh/Innmind/LogReader)
55
[![Type Coverage](https://shepherd.dev/github/Innmind/LogReader/coverage.svg)](https://shepherd.dev/github/Innmind/LogReader)
66

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"issues": "http://github.com/Innmind/LogReader/issues"
1515
},
1616
"require": {
17-
"php": "~8.2",
18-
"innmind/foundation": "~1.3",
17+
"php": "~8.4",
18+
"innmind/foundation": "~2.1",
1919
"psr/log": "^3.0"
2020
},
2121
"autoload": {
@@ -30,7 +30,7 @@
3030
},
3131
"require-dev": {
3232
"innmind/black-box": "^6.4.1",
33-
"innmind/static-analysis": "^1.2.1",
33+
"innmind/static-analysis": "~1.3",
3434
"innmind/coding-standard": "~2.0"
3535
}
3636
}

src/LineParser/ApacheAccess.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
Log,
99
Log\Attribute\Attribute,
1010
};
11-
use Innmind\TimeContinuum\{
11+
use Innmind\Time\{
1212
Clock,
13-
PointInTime,
13+
Point,
1414
Format,
1515
};
1616
use Innmind\Url\{
@@ -33,11 +33,8 @@ final class ApacheAccess implements LineParser
3333
{
3434
private const FORMAT = '~^(?P<client>\S+) - (?P<user>\S+) \[(?P<time>\d{2}/[a-zA-Z]{3}/\d{4}:\d{2}:\d{2}:\d{2} [+\-]\d{4})] "(?P<method>[A-Z]{3,}) (?P<path>.+) HTTP/(?P<protocol>\d\.\d)" (?P<code>\d+) (?P<size>\d+)$~';
3535

36-
private Clock $clock;
37-
38-
private function __construct(Clock $clock)
36+
private function __construct(private Clock $clock)
3937
{
40-
$this->clock = $clock;
4138
}
4239

4340
#[\Override]
@@ -63,7 +60,9 @@ public function __invoke(Str $line): Maybe
6360
->get('time')
6461
->map(static fn($time) => $time->toString())
6562
->keep(Is::string()->nonEmpty()->asPredicate())
66-
->flatMap($this->clock->ofFormat(Format::of('d/M/Y:H:i:s O'))->at(...));
63+
->attempt(static fn() => new \Exception)
64+
->flatMap($this->clock->ofFormat(Format::of('d/M/Y:H:i:s O'))->at(...))
65+
->maybe();
6766
$user = $parts
6867
->get('user')
6968
->map(static fn($user) => Attribute::of('user', $user));
@@ -106,7 +105,7 @@ public function __invoke(Str $line): Maybe
106105
$code,
107106
$size,
108107
)
109-
->map(static fn(PointInTime $time, Attribute ...$attributes) => Log::of(
108+
->map(static fn(Point $time, Attribute ...$attributes) => Log::of(
110109
$time,
111110
$line,
112111
Set::of(...$attributes),

src/LineParser/Monolog.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Log\Attribute\Monolog\Level,
1212
Log\Attribute\Monolog\Message,
1313
};
14-
use Innmind\TimeContinuum\{
14+
use Innmind\Time\{
1515
Clock,
1616
Format,
1717
};
@@ -32,13 +32,10 @@ final class Monolog implements LineParser
3232
private const FORMAT = '~^\[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] (?P<channel>[a-zA-Z-_]+)\.(?P<level>EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG): (?P<message>.+) (?P<context>[\{\[].*[\]\}]) (?P<extra>[\{\[].*[\]\}])$~';
3333
private const FORMAT_WITHOUT_EXTRA = '~^\[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] (?P<channel>[a-zA-Z-_]+)\.(?P<level>EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG): (?P<message>.+) (?P<context>[\{\[].*[\]\}])$~';
3434

35-
private Clock $clock;
36-
private string $format;
37-
38-
private function __construct(Clock $clock, ?string $format = null)
39-
{
40-
$this->clock = $clock;
41-
$this->format = $format ?? self::FORMAT;
35+
private function __construct(
36+
private Clock $clock,
37+
private string $format,
38+
) {
4239
}
4340

4441
#[\Override]
@@ -101,7 +98,9 @@ public function __invoke(Str $line): Maybe
10198
->get('time')
10299
->map(static fn($time) => $time->toString())
103100
->keep(Is::string()->nonEmpty()->asPredicate())
104-
->flatMap($this->clock->ofFormat(Format::of('Y-m-d H:i:s'))->at(...));
101+
->attempt(static fn() => new \Exception)
102+
->flatMap($this->clock->ofFormat(Format::of('Y-m-d H:i:s'))->at(...))
103+
->maybe();
105104

106105
return $time->flatMap(
107106
static fn($time) => $attributes->map(

src/Log.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Innmind\LogReader;
55

66
use Innmind\LogReader\Log\Attribute;
7-
use Innmind\TimeContinuum\PointInTime;
7+
use Innmind\Time\Point;
88
use Innmind\Immutable\{
99
Str,
1010
Set,
@@ -16,33 +16,28 @@
1616
*/
1717
final class Log
1818
{
19-
private PointInTime $time;
20-
private Str $raw;
21-
/** @var Set<Attribute> */
22-
private Set $attributes;
23-
2419
/**
2520
* @param Set<Attribute> $attributes
2621
*/
27-
private function __construct(PointInTime $time, Str $raw, Set $attributes)
28-
{
29-
$this->time = $time;
30-
$this->raw = $raw;
31-
$this->attributes = $attributes;
22+
private function __construct(
23+
private Point $time,
24+
private Str $raw,
25+
private Set $attributes,
26+
) {
3227
}
3328

3429
/**
3530
* @psalm-pure
3631
*
3732
* @param Set<Attribute> $attributes
3833
*/
39-
public static function of(PointInTime $time, Str $raw, Set $attributes): self
34+
public static function of(Point $time, Str $raw, Set $attributes): self
4035
{
4136
return new self($time, $raw, $attributes);
4237
}
4338

4439
#[\NoDiscard]
45-
public function time(): PointInTime
40+
public function time(): Point
4641
{
4742
return $this->time;
4843
}

src/Log/Attribute/Monolog/Channel.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
*/
1515
final class Channel implements Attribute
1616
{
17-
private string $value;
18-
19-
private function __construct(string $value)
17+
private function __construct(private string $value)
2018
{
21-
$this->value = $value;
2219
}
2320

2421
/**

src/Log/Attribute/Monolog/Level.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212
*/
1313
final class Level implements Attribute
1414
{
15-
private string $value;
16-
17-
private function __construct(string $value)
15+
private function __construct(private string $value)
1816
{
19-
$this->value = $value;
2017
}
2118

2219
/**

src/Log/Attribute/Monolog/Message.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
*/
1515
final class Message implements Attribute
1616
{
17-
private string $value;
18-
19-
private function __construct(string $value)
17+
private function __construct(private string $value)
2018
{
21-
$this->value = $value;
2219
}
2320

2421
/**

0 commit comments

Comments
 (0)