Skip to content

Commit 8e484f8

Browse files
committed
feat(dependency-analyser): add support for LaraDumps integration
- Extend `Configuration` to ignore errors for `laradumps/laradumps-core`. - Add `LaraDumpsOutput` class to handle output using LaraDumps. - Introduce `$label` to `LaraDumpsOutput` for customizable output labels. - Ensure the output method uses the `ds` function for dumping scores. - Update `testbench.yaml` to include a commented reference to `LaraDumpsServiceProvider`.
1 parent 81b53cc commit 8e484f8

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
vendor/
55

66
.DS_Store
7+
.env
78
.php-cs-fixer.cache
89
.phpunit.result.cache
910
/*.zip

composer-dependency-analyser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
[__DIR__.'/src/Outputs/DebugBarOutput.php'],
5656
[ErrorType::DEV_DEPENDENCY_IN_PROD]
5757
)
58+
->ignoreErrorsOnPackageAndPath(
59+
'laradumps/laradumps-core',
60+
__DIR__.'/src/Outputs/LaraDumpsOutput.php',
61+
[ErrorType::SHADOW_DEPENDENCY]
62+
)
5863
->ignoreErrorsOnPackageAndPath(
5964
'spatie/ray',
6065
__DIR__.'/src/Outputs/RayOutput.php',

config/soar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
// Guanguans\LaravelSoar\Outputs\DebugBarOutput::class => ['name' => 'Soar Scores', 'label' => 'warning'],
5353
// Guanguans\LaravelSoar\Outputs\DumpOutput::class => ['exit' => false],
5454
// Guanguans\LaravelSoar\Outputs\JsonOutput::class => ['key' => 'soar_scores'],
55+
// Guanguans\LaravelSoar\Outputs\LaraDumpsOutput::class => ['label' => 'Soar Scores'],
5556
Guanguans\LaravelSoar\Outputs\LogOutput::class => ['channel' => 'daily', 'level' => 'warning'],
5657
// Guanguans\LaravelSoar\Outputs\RayOutput::class => ['label' => 'Soar Scores'],
5758
],

src/Outputs/LaraDumpsOutput.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) 2020-2025 guanguans<ityaozm@gmail.com>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*
11+
* @see https://github.com/guanguans/laravel-soar
12+
*/
13+
14+
namespace Guanguans\LaravelSoar\Outputs;
15+
16+
use Illuminate\Console\Events\CommandFinished;
17+
use Illuminate\Support\Collection;
18+
use Symfony\Component\HttpFoundation\Response;
19+
20+
class LaraDumpsOutput extends AbstractOutput
21+
{
22+
public function __construct(private string $label = 'Soar Scores') {}
23+
24+
/**
25+
* @noinspection PhpMissingParentCallCommonInspection
26+
*/
27+
public function shouldOutput(CommandFinished|Response $outputter): bool
28+
{
29+
return \function_exists('ds');
30+
}
31+
32+
public function output(Collection $scores, CommandFinished|Response $outputter): mixed
33+
{
34+
return ds(...$scores)->label($this->label);
35+
}
36+
}

testbench.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ providers:
55
- Barryvdh\Debugbar\ServiceProvider
66
- Clockwork\Support\Laravel\ClockworkServiceProvider
77
- Guanguans\LaravelSoar\SoarServiceProvider
8+
- LaraDumps\LaraDumps\LaraDumpsServiceProvider
89

910
migrations:
1011
- workbench/database/migrations

tests/Pest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Guanguans\LaravelSoar\Outputs\DebugBarOutput;
2929
use Guanguans\LaravelSoar\Outputs\DumpOutput;
3030
use Guanguans\LaravelSoar\Outputs\JsonOutput;
31+
use Guanguans\LaravelSoar\Outputs\LaraDumpsOutput;
3132
use Guanguans\LaravelSoar\Outputs\LogOutput;
3233
use Guanguans\LaravelSoar\Outputs\RayOutput;
3334
use Guanguans\LaravelSoarTests\TestCase;
@@ -137,6 +138,7 @@ function extend_output_manager(null|array|string $outputs = null): void
137138
DebugBarOutput::class => ['name' => 'Soar Scores', 'label' => 'warning'],
138139
DumpOutput::class => ['exit' => false],
139140
JsonOutput::class => ['key' => 'soar_scores'],
141+
LaraDumpsOutput::class => ['label' => 'Soar Scores'],
140142
LogOutput::class => ['channel' => 'daily', 'level' => 'warning'],
141143
RayOutput::class => ['label' => 'Soar Scores'],
142144
];

0 commit comments

Comments
 (0)