Skip to content

Commit ce3f0f6

Browse files
committed
Fix styling
1 parent c87026b commit ce3f0f6

25 files changed

+60
-60
lines changed

src/Concerns/LogFile/HasMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function setMetadata(string $attribute, $value): void
1111
$this->metadata[$attribute] = $value;
1212
}
1313

14-
public function getMetadata(string $attribute = null, $default = null): mixed
14+
public function getMetadata(?string $attribute = null, $default = null): mixed
1515
{
1616
if (! isset($this->metadata)) {
1717
$this->loadMetadata();

src/Concerns/LogIndex/CanFilterIndex.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait CanFilterIndex
1313
protected ?int $limit = null;
1414
protected ?int $skip = null;
1515

16-
public function setQuery(string $query = null): self
16+
public function setQuery(?string $query = null): self
1717
{
1818
if ($this->query !== $query) {
1919
$this->query = $query;
@@ -29,7 +29,7 @@ public function getQuery(): ?string
2929
return $this->query;
3030
}
3131

32-
public function forDateRange(int|CarbonInterface $from = null, int|CarbonInterface $to = null): self
32+
public function forDateRange(int|CarbonInterface|null $from = null, int|CarbonInterface|null $to = null): self
3333
{
3434
if ($from instanceof CarbonInterface) {
3535
$from = $from->timestamp;
@@ -45,7 +45,7 @@ public function forDateRange(int|CarbonInterface $from = null, int|CarbonInterfa
4545
return $this;
4646
}
4747

48-
public function forLevels(string|array $levels = null): self
48+
public function forLevels(string|array|null $levels = null): self
4949
{
5050
if (is_string($levels)) {
5151
$levels = [$levels];
@@ -60,7 +60,7 @@ public function forLevels(string|array $levels = null): self
6060
return $this;
6161
}
6262

63-
public function exceptLevels(string|array $levels = null): self
63+
public function exceptLevels(string|array|null $levels = null): self
6464
{
6565
if (is_null($levels)) {
6666
$this->excludeLevels = null;
@@ -73,7 +73,7 @@ public function exceptLevels(string|array $levels = null): self
7373
return $this;
7474
}
7575

76-
public function forLevel(string $level = null): self
76+
public function forLevel(?string $level = null): self
7777
{
7878
return $this->forLevels($level);
7979
}
@@ -84,7 +84,7 @@ public function isLevelSelected(string $level): bool
8484
&& (is_null($this->excludeLevels) || ! in_array($level, $this->excludeLevels));
8585
}
8686

87-
public function skip(int $skip = null): self
87+
public function skip(?int $skip = null): self
8888
{
8989
$this->skip = $skip;
9090

@@ -96,7 +96,7 @@ public function getSkip(): ?int
9696
return $this->skip;
9797
}
9898

99-
public function limit(int $limit = null): self
99+
public function limit(?int $limit = null): self
100100
{
101101
$this->limit = $limit;
102102

src/Concerns/LogReader/CanFilterUsingIndex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ public function limit(int $number): static
7676
return $this;
7777
}
7878

79-
public function search(string $query = null): static
79+
public function search(?string $query = null): static
8080
{
8181
return $this->setQuery($query);
8282
}
8383

84-
protected function setQuery(string $query = null): static
84+
protected function setQuery(?string $query = null): static
8585
{
8686
$this->closeFile();
8787

src/Concerns/LogReader/CanSetDirectionUsingIndex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function forward(): static
1616
return $this->setDirection(Direction::Forward);
1717
}
1818

19-
public function setDirection(string $direction = null): static
19+
public function setDirection(?string $direction = null): static
2020
{
2121
$direction = $direction === Direction::Backward
2222
? Direction::Backward

src/LogFile.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LogFile
2424
private ?string $type = null;
2525
private array $_logIndexCache;
2626

27-
public function __construct(string $path, string $type = null)
27+
public function __construct(string $path, ?string $type = null)
2828
{
2929
$this->path = $path;
3030
$this->name = basename($path);
@@ -59,7 +59,7 @@ public function type(): LogType
5959
return new LogType($this->type ?? LogType::DEFAULT);
6060
}
6161

62-
public function index(string $query = null): LogIndex
62+
public function index(?string $query = null): LogIndex
6363
{
6464
if (! isset($this->_logIndexCache[$query])) {
6565
$this->_logIndexCache[$query] = new LogIndex($this, $query);
@@ -171,7 +171,7 @@ public function latestTimestamp(): int
171171
return $this->getMetadata('latest_timestamp') ?? $this->mtime();
172172
}
173173

174-
public function scan(int $maxBytesToScan = null, bool $force = false): void
174+
public function scan(?int $maxBytesToScan = null, bool $force = false): void
175175
{
176176
$this->logs()->scan($maxBytesToScan, $force);
177177
}
@@ -184,7 +184,7 @@ public function requiresScan(): bool
184184
/**
185185
* @throws InvalidRegularExpression
186186
*/
187-
public function search(string $query = null): LogReaderInterface
187+
public function search(?string $query = null): LogReaderInterface
188188
{
189189
return $this->logs()->search($query);
190190
}

src/LogIndex.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
$this->loadMetadata();
3131
}
3232

33-
public function addToIndex(int $filePosition, int|CarbonInterface $timestamp, string $severity, int $index = null): int
33+
public function addToIndex(int $filePosition, int|CarbonInterface $timestamp, string $severity, ?int $index = null): int
3434
{
3535
$logIndex = $index ?? $this->nextLogIndexToCreate ?? 0;
3636

@@ -75,7 +75,7 @@ public function getPositionForIndex(int $indexToFind): ?int
7575
return null;
7676
}
7777

78-
public function get(int $limit = null): array
78+
public function get(?int $limit = null): array
7979
{
8080
$results = [];
8181
$itemsAdded = 0;
@@ -157,7 +157,7 @@ public function get(int $limit = null): array
157157
return $results;
158158
}
159159

160-
public function getFlatIndex(int $limit = null): array
160+
public function getFlatIndex(?int $limit = null): array
161161
{
162162
$results = [];
163163
$itemsAdded = 0;

src/LogLevels/HorizonStatusLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(string $value)
1111
$this->value = $value;
1212
}
1313

14-
public static function from(string $value = null): LevelInterface
14+
public static function from(?string $value = null): LevelInterface
1515
{
1616
return new static($value);
1717
}

src/LogLevels/HttpStatusCodeLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function __construct(
99
) {
1010
}
1111

12-
public static function from(string $value = null): LevelInterface
12+
public static function from(?string $value = null): LevelInterface
1313
{
1414
return new static($value);
1515
}

src/LogLevels/LaravelLogLevel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class LaravelLogLevel implements LevelInterface
1616

1717
public string $value;
1818

19-
public function __construct(string $value = null)
19+
public function __construct(?string $value = null)
2020
{
2121
$this->value = $value ?? self::None;
2222
}
@@ -36,7 +36,7 @@ public static function cases(): array
3636
];
3737
}
3838

39-
public static function from(string $value = null): self
39+
public static function from(?string $value = null): self
4040
{
4141
return new self($value);
4242
}

src/LogLevels/LevelClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(
1515
) {
1616
}
1717

18-
public static function from(string $value = null): LevelClass
18+
public static function from(?string $value = null): LevelClass
1919
{
2020
return new static($value);
2121
}

src/LogLevels/LevelInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface LevelInterface
66
{
77
public function __construct(string $value);
88

9-
public static function from(string $value = null): self;
9+
public static function from(?string $value = null): self;
1010

1111
public static function caseValues(): array;
1212

src/LogLevels/NginxStatusLevel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class NginxStatusLevel implements LevelInterface
1515

1616
public string $value;
1717

18-
public function __construct(string $value = null)
18+
public function __construct(?string $value = null)
1919
{
2020
$this->value = $value ?? self::Error;
2121
}
@@ -34,7 +34,7 @@ public static function cases(): array
3434
];
3535
}
3636

37-
public static function from(string $value = null): self
37+
public static function from(?string $value = null): self
3838
{
3939
return new self($value);
4040
}

src/LogLevels/PostgresLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(string $value)
1111
$this->value = $value;
1212
}
1313

14-
public static function from(string $value = null): LevelInterface
14+
public static function from(?string $value = null): LevelInterface
1515
{
1616
return new static($value);
1717
}

src/LogLevels/RedisLogLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(string $value)
1111
$this->value = $value;
1212
}
1313

14-
public static function from(string $value = null): LevelInterface
14+
public static function from(?string $value = null): LevelInterface
1515
{
1616
return new static($value);
1717
}

src/LogLevels/SupervisorLogLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(string $value)
2525
$this->value = $value;
2626
}
2727

28-
public static function from(string $value = null): LevelInterface
28+
public static function from(?string $value = null): LevelInterface
2929
{
3030
return new static($value);
3131
}

src/Logs/HorizonLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function fillMatches(array $matches = []): void
3131
]);
3232
}
3333

34-
public static function matches(string $text, int &$timestamp = null, string &$level = null): bool
34+
public static function matches(string $text, ?int &$timestamp = null, ?string &$level = null): bool
3535
{
3636
return parent::matches($text, $timestamp, $level)
3737
|| (str_contains($text, 'Horizon started successfully') && throw new SkipLineException);

src/Logs/Log.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Log
4646
public ?int $filePosition;
4747
public ?int $index;
4848

49-
public function __construct(string $text, string $fileIdentifier = null, int $filePosition = null, int $index = null)
49+
public function __construct(string $text, ?string $fileIdentifier = null, ?int $filePosition = null, ?int $index = null)
5050
{
5151
$this->text = rtrim($text);
5252
$this->fileIdentifier = $fileIdentifier;
@@ -60,7 +60,7 @@ public function __construct(string $text, string $fileIdentifier = null, int $fi
6060
unset($matches);
6161
}
6262

63-
public static function matches(string $text, int &$timestamp = null, string &$level = null): bool
63+
public static function matches(string $text, ?int &$timestamp = null, ?string &$level = null): bool
6464
{
6565
$matches = [];
6666
$result = preg_match(static::$regex, $text, $matches) === 1;

src/Readers/IndexedLogReader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function lazyScanning($lazy = true): static
4848
*
4949
* @throws CannotOpenFileException
5050
*/
51-
public function scan(int $maxBytesToScan = null, bool $force = false): static
51+
public function scan(?int $maxBytesToScan = null, bool $force = false): static
5252
{
5353
if (is_null($maxBytesToScan)) {
5454
$maxBytesToScan = LogViewer::lazyScanChunkSize();
@@ -188,7 +188,7 @@ public function getLevelCounts(): array
188188
*
189189
* @throws CannotOpenFileException
190190
*/
191-
public function get(int $limit = null): array
191+
public function get(?int $limit = null): array
192192
{
193193
if (! is_null($limit) && method_exists($this, 'limit')) {
194194
$this->limit($limit);
@@ -230,7 +230,7 @@ public function total(): int
230230
return $this->index()->count();
231231
}
232232

233-
public function paginate(int $perPage = 25, int $page = null)
233+
public function paginate(int $perPage = 25, ?int $page = null)
234234
{
235235
$page = $page ?: Paginator::resolveCurrentPage('page');
236236

src/Readers/LogReaderInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static function clearInstance(LogFile $file): void;
1515
public static function clearInstances(): void;
1616

1717
// Search/querying
18-
public function search(string $query = null): static;
18+
public function search(?string $query = null): static;
1919

2020
public function skip(int $number): static;
2121

@@ -26,7 +26,7 @@ public function reverse(): static;
2626

2727
public function forward(): static;
2828

29-
public function setDirection(string $direction = null): static;
29+
public function setDirection(?string $direction = null): static;
3030

3131
public function getLevelCounts(): array;
3232

@@ -41,20 +41,20 @@ public function except($levels = null): static;
4141
public function exceptLevels($levels = null): static;
4242

4343
// Retrieving actual logs
44-
public function get(int $limit = null): array;
44+
public function get(?int $limit = null): array;
4545

4646
public function next(): ?Log;
4747

4848
/** @return LengthAwarePaginator<Log> */
49-
public function paginate(int $perPage = 25, int $page = null);
49+
public function paginate(int $perPage = 25, ?int $page = null);
5050

5151
public function total(): int;
5252

5353
// Functional
5454
public function reset(): static;
5555

5656
// We should decouple scanning from the LogReader
57-
public function scan(int $maxBytesToScan = null, bool $force = false): static;
57+
public function scan(?int $maxBytesToScan = null, bool $force = false): static;
5858

5959
public function numberOfNewBytes(): int;
6060

src/Readers/MultipleLogReader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function allLevels(): self
4848
return $this;
4949
}
5050

51-
public function setDirection(string $direction = null): self
51+
public function setDirection(?string $direction = null): self
5252
{
5353
$this->direction = $direction === Direction::Backward
5454
? Direction::Backward
@@ -87,7 +87,7 @@ public function limit(int $number): self
8787
return $this;
8888
}
8989

90-
public function search(string $query = null): self
90+
public function search(?string $query = null): self
9191
{
9292
$this->query = $query;
9393

@@ -121,7 +121,7 @@ public function total(): int
121121
});
122122
}
123123

124-
public function paginate($perPage = 25, int $page = null): LengthAwarePaginator
124+
public function paginate($perPage = 25, ?int $page = null): LengthAwarePaginator
125125
{
126126
$page = $page ?: Paginator::resolveCurrentPage('page');
127127

@@ -140,7 +140,7 @@ public function paginate($perPage = 25, int $page = null): LengthAwarePaginator
140140
*
141141
* @return array|Log[]
142142
*/
143-
public function get(int $limit = null): array
143+
public function get(?int $limit = null): array
144144
{
145145
$skip = $this->skip ?? null;
146146
$limit = $limit ?? $this->limit ?? null;
@@ -204,7 +204,7 @@ public function percentScanned(): int
204204
return 100 - intval($missingScansBytes / $totalFileBytes * 100);
205205
}
206206

207-
public function scan(int $maxBytesToScan = null, bool $force = false): void
207+
public function scan(?int $maxBytesToScan = null, bool $force = false): void
208208
{
209209
$fileSizeScanned = 0;
210210
$stopScanningAfter = microtime(true) + LogViewer::lazyScanTimeout();

0 commit comments

Comments
 (0)