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

fix: use shop interface instead of abstract shop class #41

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

lernhart
Copy link
Member

Checking for AbstractShop in the Repository leaves devs no choice, but to use the abstract class.

Changed this to check for the ShopInterface instead

@lernhart lernhart self-assigned this Oct 19, 2023
*/
public function __construct(
private readonly string $entityClass,
private readonly ManagerRegistry $registry
) {
if (!is_subclass_of($this->entityClass, AbstractShop::class)) {
throw new \InvalidArgumentException(sprintf('The shop entity class "%s" must extend "%s"', $this->entityClass, AbstractShop::class));
if (!is_subclass_of($this->entityClass, ShopInterface::class)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really working for interfaces? not class_implements?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.php.net/manual/en/function.is-subclass-of.php

"Checks if the given object_or_class has the class class as one of its parents or implements it."

@lernhart lernhart requested a review from shyim October 24, 2023 11:21
@Christian-Rades Christian-Rades merged commit 6fb93fe into main Oct 24, 2023
7 checks passed
@Christian-Rades Christian-Rades deleted the fix/use-shop-interface branch October 24, 2023 11:34
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.

3 participants