Skip to content

Commit 6b0e069

Browse files
Add Laravel 10 support (#13)
* Add Laravel 10 support * Fix Laravel 10 for NonConsole * Repair test by allowing dependencies upgrade --------- Co-authored-by: Mitchell M <[email protected]>
1 parent d14324b commit 6b0e069

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

.github/workflows/laravel-test.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
laravel: ^8.0
3636
- php: 8.1
3737
laravel: ^9.0
38+
- php: 8.2
39+
laravel: ^10.0
3840

3941
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
4042

@@ -87,7 +89,7 @@ jobs:
8789
cd laravel-app
8890
ls -lha
8991
cat composer.json
90-
composer update --no-interaction --no-progress
92+
composer update --no-interaction --no-progress --with-all-dependencies
9193
php artisan package:discover --ansi
9294
php artisan clear-compiled
9395

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ php artisan my:command -vvv
7878

7979
| Compatible | Laravel |
8080
|--------------------|---------|
81-
| :heavy_check_mark: | 9.* |
82-
| :heavy_check_mark: | 8.* |
83-
| :heavy_check_mark: | 7.* |
84-
| :heavy_check_mark: | 6.* |
81+
| :heavy_check_mark: | 10.* |
82+
| :heavy_check_mark: | 9.* |
83+
| :heavy_check_mark: | 8.* |
84+
| :heavy_check_mark: | 7.* |
85+
| :heavy_check_mark: | 6.* |
8586

8687
---
8788

src/LogHandlers/ConsoleApp.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@ public function getProcessors(): array
1919
return [];
2020
}
2121

22-
public function isHandling(array $record): bool
22+
/**
23+
* @param array|Monolog\LogRecord $record
24+
*/
25+
public function isHandling($record): bool
2326
{
2427
return true;
2528
}
2629

27-
public function handle(array $record): bool
30+
/**
31+
* @param array|Monolog\LogRecord $record
32+
*/
33+
public function handle($record): bool
2834
{
29-
$this->log(strtolower($record['level_name'] ?? ''), $record['message'] ?? '', $record['context'] ?? []);
35+
$recordArray = is_array($record) ? $record : $record->toArray();
36+
$this->log(strtolower($recordArray['level_name'] ?? ''), $recordArray['message'] ?? '', $recordArray['context'] ?? []);
3037

3138
return true;
3239
}
3340

34-
public function handleBatch(array $records): void
41+
/**
42+
* @param array|Monolog\LogRecord $record
43+
*/
44+
public function handleBatch($records): void
3545
{
3646
foreach ($records as $record) {
3747
$this->handle($record);

src/LogHandlers/NonConsole.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ public function getHandlers(): array
1515
return [];
1616
}
1717

18-
public function isHandling(array $record): bool
18+
/**
19+
* @param array|Monolog\LogRecord $record
20+
*/
21+
public function isHandling($record): bool
1922
{
2023
return false;
2124
}
@@ -25,12 +28,18 @@ public function getProcessors(): array
2528
return [];
2629
}
2730

28-
public function handle(array $record): bool
31+
/**
32+
* @param array|Monolog\LogRecord $record
33+
*/
34+
public function handle($record): bool
2935
{
3036
return false;
3137
}
3238

33-
public function handleBatch(array $records): void
39+
/**
40+
* @param array|Monolog\LogRecord $record
41+
*/
42+
public function handleBatch($records): void
3443
{
3544
}
3645

0 commit comments

Comments
 (0)