Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Jun 11, 2024
1 parent a52b850 commit 5631864
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Spatie\Ignition\Solutions\SolutionProviders;

use Spatie\ErrorSolutions\SolutionProviders\SolutionProviderRepository as BaseSolutionProviderRepositoryAlias;
use Spatie\ErrorSolutions\SolutionProviderRepository as BaseSolutionProviderRepositoryAlias;
use Spatie\Ignition\Contracts\SolutionProviderRepository as SolutionProviderRepositoryContract;

class SolutionProviderRepository extends BaseSolutionProviderRepositoryAlias implements SolutionProviderRepositoryContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

namespace Spatie\LaravelIgnition\Solutions\SolutionProviders;

use Illuminate\Support\Collection;
use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable;
use Spatie\ErrorSolutions\Contracts\ProvidesSolution;
use Spatie\ErrorSolutions\Contracts\Solution;
use Spatie\ErrorSolutions\SolutionProviderRepository as BaseSolutionProviderRepositoryAlias;
use Spatie\Ignition\Contracts\SolutionProviderRepository as SolutionProviderRepositoryContract;
use Throwable;

class SolutionProviderRepository extends \Spatie\ErrorSolutions\SolutionProviders\Laravel\SolutionProviderRepository implements SolutionProviderRepositoryContract
class SolutionProviderRepository extends BaseSolutionProviderRepositoryAlias implements SolutionProviderRepositoryContract
{

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Spatie\ErrorSolutions\SolutionProviders;
namespace Spatie\ErrorSolutions;

use Illuminate\Support\Collection;
use Spatie\ErrorSolutions\Contracts\HasSolutionsForThrowable;
Expand Down Expand Up @@ -89,7 +89,17 @@ public function getSolutionForClass(string $solutionClass): ?Solution
protected function initialiseSolutionProviderRepositories(): Collection
{
return $this->solutionProviders
->filter(fn (HasSolutionsForThrowable|string $provider) => in_array(HasSolutionsForThrowable::class, class_implements($provider) ?: []))
->filter(function (HasSolutionsForThrowable|string $provider) {
if (! in_array(HasSolutionsForThrowable::class, class_implements($provider) ?: [])) {
return false;
}

if (function_exists('config') && in_array($provider, config('ErrorSolutions.ignored_solution_providers', []))) {
return false;
}

return true;
})
->map(function (string|HasSolutionsForThrowable $provider): HasSolutionsForThrowable {
if (is_string($provider)) {
return new $provider;
Expand Down
98 changes: 0 additions & 98 deletions src/SolutionProviders/Laravel/SolutionProviderRepository.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/ExceptionSolutionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use Illuminate\Foundation\Auth\User;
use Spatie\ErrorSolutions\Contracts\BaseSolution;
use Spatie\ErrorSolutions\SolutionProviderRepository;
use Spatie\ErrorSolutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\ErrorSolutions\SolutionProviders\Laravel\MissingAppKeySolutionProvider;
use Spatie\ErrorSolutions\SolutionProviders\SolutionProviderRepository;
use Spatie\ErrorSolutions\Tests\Exceptions\AlwaysFalseSolutionProvider;
use Spatie\ErrorSolutions\Tests\Exceptions\AlwaysTrueSolutionProvider;

Expand Down

0 comments on commit 5631864

Please sign in to comment.