Skip to content

Commit 82ec7ee

Browse files
Remove error solution support
Drops the spatie/error-solutions integration and the solutions field from reports. Solutions are no longer surfaced in the Flare payload and the related collect type, middleware, and config methods have been removed.
1 parent 30e8017 commit 82ec7ee

23 files changed

Lines changed: 1 addition & 168 deletions

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"guzzlehttp/guzzle": "^7.9",
1616
"psr/container": "^2.0",
1717
"spatie/backtrace": "^1.8.0",
18-
"spatie/error-solutions": "^2.0",
1918
"symfony/http-foundation": "^5.2|^6.0|^7.0|^8.0",
2019
"symfony/mime": "^5.2|^6.0|^7.0|^8.0",
2120
"symfony/process": "^5.2|^6.0|^7.0|^8.0",

src/Disabled/DisabledFlare.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,6 @@ public function withApplicationStage(string|Closure $stage): self
196196
return $this;
197197
}
198198

199-
public function withSolutionProvider(string ...$solutionProviders): self
200-
{
201-
return $this;
202-
}
203-
204199
public function filterExceptionsUsing(Closure $filterExceptionsCallable): static
205200
{
206201
return $this;

src/Enums/CollectType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ enum CollectType: string implements FlareCollectType
1414
case Cache = 'cache';
1515
case Glows = 'glows';
1616
case Logs = 'logs';
17-
case Solutions = 'solutions';
1817
case Throwables = 'throwables';
1918
case Queries = 'queries';
2019
case Transactions = 'database_transactions';

src/Flare.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
use ErrorException;
88
use Exception;
99
use Spatie\Backtrace\Arguments\ArgumentReducers;
10-
use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable;
11-
use Spatie\ErrorSolutions\Contracts\SolutionProviderRepository;
1210
use Spatie\FlareClient\Contracts\Recorders\Recorder;
1311
use Spatie\FlareClient\Enums\OverriddenGrouping;
1412
use Spatie\FlareClient\Enums\RecorderType;
@@ -68,7 +66,6 @@ public function __construct(
6866
protected readonly ?int $reportErrorLevels,
6967
protected null|Closure $filterExceptionsCallable,
7068
protected null|Closure $filterReportsCallable,
71-
protected readonly SolutionProviderRepository $solutionProviderRepository,
7269
protected readonly null|ArgumentReducers $argumentReducers,
7370
protected readonly bool $collectStackFrameArguments,
7471
protected Resource $resource,
@@ -490,16 +487,6 @@ public function withApplicationStage(string|Closure $stage): self
490487
return $this;
491488
}
492489

493-
/**
494-
* @param class-string<HasSolutionsForThrowable> ...$solutionProviders
495-
*/
496-
public function withSolutionProvider(string ...$solutionProviders): self
497-
{
498-
$this->solutionProviderRepository->registerSolutionProviders($solutionProviders);
499-
500-
return $this;
501-
}
502-
503490
/**
504491
* @param Closure(Exception): bool $filterExceptionsCallable
505492
*/

src/FlareConfig.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
use Spatie\Backtrace\Arguments\Reducers\EnumArgumentReducer;
1515
use Spatie\Backtrace\Arguments\Reducers\StdClassArgumentReducer;
1616
use Spatie\Backtrace\Arguments\Reducers\SymphonyRequestArgumentReducer;
17-
use Spatie\ErrorSolutions\SolutionProviderRepository;
18-
use Spatie\ErrorSolutions\SolutionProviders\BadMethodCallSolutionProvider;
19-
use Spatie\ErrorSolutions\SolutionProviders\MergeConflictSolutionProvider;
20-
use Spatie\ErrorSolutions\SolutionProviders\UndefinedPropertySolutionProvider;
2117
use Spatie\FlareClient\AttributesProviders\ConsoleAttributesProvider;
2218
use Spatie\FlareClient\AttributesProviders\EmptyUserAttributesProvider;
2319
use Spatie\FlareClient\AttributesProviders\RequestAttributesProvider;
@@ -65,7 +61,6 @@ class FlareConfig
6561
* @param null|Closure(Report): bool $filterReportsCallable
6662
* @param array<string, array{type: FlareCollectType, ignored: ?bool, options: array}> $collects
6763
* @param class-string<Sender> $sender
68-
* @param class-string<SolutionProviderRepository> $solutionsProviderRepository
6964
* @param Closure(Scope):void|null $configureScopeCallable
7065
* @param Closure(Resource):void|null $configureResourceCallable
7166
* @param Closure(Span):(void|Span)|null $configureSpansCallable
@@ -92,7 +87,6 @@ public function __construct(
9287
public ?string $applicationStage = null,
9388
public string $sender = CurlSender::class,
9489
public array $senderConfig = [],
95-
public string $solutionsProviderRepository = SolutionProviderRepository::class,
9690
public bool $trace = false,
9791
public string $sampler = RateSampler::class,
9892
public array $samplerConfig = [],
@@ -175,7 +169,6 @@ public function useDefaults(): static
175169
->collectGitInfo()
176170
->collectViews()
177171
->collectGlows()
178-
->collectSolutions()
179172
->collectErrorsWithTraces()
180173
->collectStackFrameArguments()
181174
->collectServerInfo()
@@ -193,15 +186,6 @@ public function useDefaults(): static
193186
);
194187
}
195188

196-
public static function defaultSolutionProviders(): array
197-
{
198-
return [
199-
BadMethodCallSolutionProvider::class,
200-
MergeConflictSolutionProvider::class,
201-
UndefinedPropertySolutionProvider::class,
202-
];
203-
}
204-
205189
public static function defaultArgumentReducers(): array
206190
{
207191
return [
@@ -317,21 +301,6 @@ public function ignoreLogs(): static
317301
return $this->ignoreCollect(CollectType::Logs);
318302
}
319303

320-
public function collectSolutions(
321-
?array $solutionProviders = null,
322-
array $extra = [],
323-
): static {
324-
return $this->addCollect(CollectType::Solutions, [
325-
'solution_providers' => $solutionProviders ?? static::defaultSolutionProviders(),
326-
...$extra,
327-
]);
328-
}
329-
330-
public function ignoreSolutions(): static
331-
{
332-
return $this->ignoreCollect(CollectType::Solutions);
333-
}
334-
335304
public function collectDumps(
336305
bool $withTraces = DumpRecorder::DEFAULT_WITH_TRACES,
337306
bool $withErrors = DumpRecorder::DEFAULT_WITH_ERRORS,

src/FlareMiddleware/AddSolutions.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/FlareProvider.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Closure;
66
use Illuminate\Contracts\Container\Container as IlluminateContainer;
77
use Spatie\Backtrace\Arguments\ArgumentReducers;
8-
use Spatie\ErrorSolutions\Contracts\SolutionProviderRepository as SolutionProviderRepositoryContract;
98
use Spatie\FlareClient\AttributesProviders\ConsoleAttributesProvider;
109
use Spatie\FlareClient\AttributesProviders\GitAttributesProvider;
1110
use Spatie\FlareClient\AttributesProviders\RequestAttributesProvider;
@@ -124,7 +123,6 @@ public function register(): void
124123
[
125124
'middlewares' => $middlewares,
126125
'recorders' => $recorders,
127-
'solutionProviders' => $solutionProviders,
128126
'resourceModifiers' => $resourceModifiers,
129127
'collectStackFrameArguments' => $collectStackFrameArguments,
130128
'argumentReducers' => $argumentReducers,
@@ -138,15 +136,6 @@ public function register(): void
138136
default => $argumentReducers,
139137
});
140138

141-
$this->container->singleton(SolutionProviderRepositoryContract::class, function () use ($solutionProviders) {
142-
/** @var SolutionProviderRepositoryContract $repository */
143-
$repository = new $this->config->solutionsProviderRepository;
144-
145-
$repository->registerSolutionProviders($solutionProviders);
146-
147-
return $repository;
148-
});
149-
150139
$this->container->singleton(Resource::class, function () use ($resourceModifiers) {
151140
$resource = new Resource(
152141
$this->config->applicationName,
@@ -231,7 +220,6 @@ function ($recorder) {
231220
reportErrorLevels: $this->config->reportErrorLevels,
232221
filterExceptionsCallable: $this->config->filterExceptionsCallable,
233222
filterReportsCallable: $this->config->filterReportsCallable,
234-
solutionProviderRepository: $this->container->get(SolutionProviderRepositoryContract::class),
235223
argumentReducers: $this->container->get(ArgumentReducers::class),
236224
collectStackFrameArguments: $collectStackFrameArguments,
237225
resource: $this->container->get(Resource::class),

src/Report.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class Report
1010
{
1111
/**
1212
* @param array<int, array{file: string, lineNumber: int, method: string|null, class: string|null, codeSnippet: array<string>, arguments: array|null, isApplicationFrame: bool}> $stacktrace
13-
* @param array<int, array{class: string, title: string, description: string, links: string[], actionDescription: string|null, isRunnable: bool, aiGenerated: bool}> $solutions
1413
* @param array<int|string, array{type: FlareSpanType|FlareSpanEventType, startTimeUnixNano: int, endTimeUnixNano: int|null, attributes: array}> $events
1514
*/
1615
public function __construct(
@@ -22,7 +21,6 @@ public function __construct(
2221
public readonly int $timeUs,
2322
public readonly ?string $level = null,
2423
public readonly array $attributes = [],
25-
public readonly array $solutions = [],
2624
public readonly ?string $applicationPath = null,
2725
public readonly ?int $openFrameIndex = null,
2826
public readonly ?bool $handled = null,
@@ -42,7 +40,6 @@ public function toArray(): array
4240
'seenAtUnixNano' => $this->timeUs,
4341
'message' => $this->message,
4442
'code' => $this->code,
45-
'solutions' => $this->solutions,
4643
'stacktrace' => $this->stacktrace,
4744
'openFrameIndex' => $this->openFrameIndex,
4845
'applicationPath' => $this->applicationPath,

src/ReportFactory.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
use Spatie\Backtrace\Arguments\ArgumentReducers;
88
use Spatie\Backtrace\Backtrace;
99
use Spatie\Backtrace\Frame;
10-
use Spatie\ErrorSolutions\Contracts\RunnableSolution;
11-
use Spatie\ErrorSolutions\Contracts\Solution;
1210
use Spatie\FlareClient\Concerns\HasAttributes;
1311
use Spatie\FlareClient\Contracts\ProvidesFlareContext;
1412
use Spatie\FlareClient\Contracts\WithAttributes;
@@ -40,9 +38,6 @@ class ReportFactory implements WithAttributes
4038
/** @var array<Span|SpanEvent> */
4139
public array $events = [];
4240

43-
/** @var array<Solution> */
44-
public array $solutions = [];
45-
4641
public ?string $notifierName = null;
4742

4843
public ?bool $handled = null;
@@ -145,13 +140,6 @@ public function notifier(string $name): self
145140
return $this;
146141
}
147142

148-
public function addSolutions(Solution ...$solution): self
149-
{
150-
array_push($this->solutions, ...$solution);
151-
152-
return $this;
153-
}
154-
155143
public function argumentReducers(null|ArgumentReducers $argumentReducers): self
156144
{
157145
$this->argumentReducers = $argumentReducers;
@@ -238,7 +226,6 @@ public function build(
238226
timeUs: $time->getCurrentTime(),
239227
level: $this->level,
240228
attributes: $attributes,
241-
solutions: $this->mapSolutions(),
242229
applicationPath: $this->applicationPath,
243230
openFrameIndex: null,
244231
handled: $this->handled,
@@ -294,24 +281,4 @@ protected function buildStacktrace(): array
294281

295282
return array_values(array_slice($frames, $firstApplicationFrameIndex));
296283
}
297-
298-
protected function mapSolutions(): array
299-
{
300-
return array_map(
301-
function (Solution $solution) {
302-
$isRunnable = $solution instanceof RunnableSolution;
303-
304-
return [
305-
'class' => get_class($solution),
306-
'title' => $solution->getSolutionTitle(),
307-
'description' => $solution->getSolutionDescription(),
308-
'links' => $solution->getDocumentationLinks(),
309-
'actionDescription' => $isRunnable ? $solution->getSolutionActionDescription() : null,
310-
'isRunnable' => $isRunnable,
311-
'aiGenerated' => $solution->aiGenerated ?? false,
312-
];
313-
},
314-
$this->solutions
315-
);
316-
}
317284
}

src/Support/CollectsResolver.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
use Psr\Container\ContainerInterface;
66
use Spatie\Backtrace\Arguments\ArgumentReducers;
77
use Spatie\Backtrace\Arguments\Reducers\ArgumentReducer;
8-
use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable;
98
use Spatie\FlareClient\AttributesProviders\GitAttributesProvider;
109
use Spatie\FlareClient\Contracts\FlareCollectType;
1110
use Spatie\FlareClient\Contracts\Recorders\Recorder;
1211
use Spatie\FlareClient\Enums\CollectType;
1312
use Spatie\FlareClient\FlareMiddleware\AddConsoleInformation;
1413
use Spatie\FlareClient\FlareMiddleware\AddGitInformation;
1514
use Spatie\FlareClient\FlareMiddleware\AddRequestInformation;
16-
use Spatie\FlareClient\FlareMiddleware\AddSolutions;
1715
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
1816
use Spatie\FlareClient\Recorders\ApplicationRecorder\ApplicationRecorder;
1917
use Spatie\FlareClient\Recorders\CacheRecorder\CacheRecorder;
@@ -40,9 +38,6 @@ class CollectsResolver
4038
/** @var array<class-string<Recorder>, array<string, mixed>> */
4139
protected array $recorders = [];
4240

43-
/** @var array<class-string<HasSolutionsForThrowable>> */
44-
protected array $solutionProviders = [];
45-
4641
/** @var array<callable(Resource, ContainerInterface):Resource> */
4742
protected array $resourceModifiers = [];
4843

@@ -55,7 +50,7 @@ class CollectsResolver
5550

5651
protected bool $collectErrorsWithTraces = false;
5752

58-
/** @return array{middlewares: array<class-string<FlareMiddleware>, array>, recorders: array<class-string<Recorder>, array>, solutionProviders: array<class-string<HasSolutionsForThrowable>>, resourceModifiers: array<callable(Resource, ContainerInterface):Resource>, collectStackFrameArguments: bool, argumentReducers: array<class-string<ArgumentReducer>|ArgumentReducer>|ArgumentReducers, forcePHPStackFrameArgumentsIniSetting: bool, collectErrorsWithTraces:bool} */
53+
/** @return array{middlewares: array<class-string<FlareMiddleware>, array>, recorders: array<class-string<Recorder>, array>, resourceModifiers: array<callable(Resource, ContainerInterface):Resource>, collectStackFrameArguments: bool, argumentReducers: array<class-string<ArgumentReducer>|ArgumentReducer>|ArgumentReducers, forcePHPStackFrameArgumentsIniSetting: bool, collectErrorsWithTraces:bool} */
5954
public function execute(
6055
array $collects,
6156
): array {
@@ -81,7 +76,6 @@ public function execute(
8176
CollectType::Cache => $this->cache($options),
8277
CollectType::Glows => $this->glows($options),
8378
CollectType::Logs => $this->logs($options),
84-
CollectType::Solutions => $this->solutions($options),
8579
CollectType::Dumps => $this->dumps($options),
8680
CollectType::Queries => $this->queries($options),
8781
CollectType::Transactions => $this->transactions($options),
@@ -102,7 +96,6 @@ public function execute(
10296
return [
10397
'middlewares' => $this->middlewares,
10498
'recorders' => $this->recorders,
105-
'solutionProviders' => $this->solutionProviders,
10699
'collectStackFrameArguments' => $this->collectStackFrameArguments,
107100
'argumentReducers' => $this->argumentReducers,
108101
'forcePHPStackFrameArgumentsIniSetting' => $this->forcePHPStackFrameArgumentsIniSetting,
@@ -190,12 +183,6 @@ protected function logs(array $options): void
190183
]));
191184
}
192185

193-
protected function solutions(array $solutions): void
194-
{
195-
$this->addMiddleware($solutions['middleware'] ?? AddSolutions::class);
196-
$this->solutionProviders = $solutions['solution_providers'] ?? [];
197-
}
198-
199186
protected function dumps(array $options): void
200187
{
201188
$this->addRecorder(

0 commit comments

Comments
 (0)