Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve solution provider repo interface #160

Merged
merged 4 commits into from
Aug 26, 2022

Conversation

AlexVanderbist
Copy link
Member

This PR updates the (internal) SolutionProviderRepository interface to allow instances of SolutionProviders to be passed to the solution provider repo like the doc blocks suggest.

Closes #121

@AlexVanderbist
Copy link
Member Author

Failing tests are not relevant to this PR.

@AlexVanderbist AlexVanderbist merged commit 57275ea into main Aug 26, 2022
@AlexVanderbist AlexVanderbist deleted the improve-solution-provider-repo-interface branch August 26, 2022 09:26
@Jubeki
Copy link
Contributor

Jubeki commented Aug 26, 2022

@AlexVanderbist

Just to make you aware, this broke spatie/laravel-ignition because Spatie\LaravelIgnition\Solutions\SolutionProviders\SolutionProviderRepository also implements the Contract SolutionProviderRepositoryContract

@mohamedyasser
Copy link

@AlexVanderbist

Just a confirmation for @Jubeki comment it broke
Spatie\LaravelIgnition\Solutions\SolutionProviders\SolutionProviderRepository::registerSolutionProvider
it must be compatible with Contract SolutionProviderRepository

Whoops\Exception\ErrorException

Declaration of Spatie\LaravelIgnition\Solutions\SolutionProviders\SolutionProviderRepository::registerSolutionProvider(string $solutionProviderClass): Spatie\Ignition\Contracts\SolutionProviderRepository must be compatible with Spatie\Ignition\Contracts\SolutionProviderRepository::registerSolutionProvider(Spatie\Ignition\Contracts\HasSolutionsForThrowable|string $solutionProvider): Spatie\Ignition\Contracts\SolutionProviderRepository

at vendor/spatie/laravel-ignition/src/Solutions/SolutionProviders/SolutionProviderRepository.php:24
20▕ {
21▕ $this->solutionProviders = Collection::make($solutionProviders);
22▕ }
23▕
➜ 24▕ public function registerSolutionProvider(string $solutionProviderClass): SolutionProviderRepositoryContract
25▕ {
26▕ $this->solutionProviders->push($solutionProviderClass);
27▕
28▕ return $this;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot pass instances of ProvidesSolution to SolutionProviderRepository::registerSolutionProviders
3 participants