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

PHP interfaces of models must declare getEmbedded() method #1896

Open
nevmerzhitsky opened this issue Sep 25, 2024 · 0 comments
Open

PHP interfaces of models must declare getEmbedded() method #1896

nevmerzhitsky opened this issue Sep 25, 2024 · 0 comments

Comments

@nevmerzhitsky
Copy link

Almost all API models have _embedded key in responses, therefore all related PHP interfaces of model classes could declare the getter. For some models, only the final model classes define the getter but not the class's interface. This seems incorrect. And this ruins static analyzers like Psalm.

For example, interface PaymentInstrument realized by 5 model classes:

  • AlternativeInstrument
  • BankAccount
  • KhelocardCard
  • PaymentCard
  • PayPalAccount

Each has public function getEmbedded(), so the declaration public function getEmbedded(): ?object must exist in the interface.

The difference in return types in the case of each model class is not a problem, because PHP fully supports return covariance from PHP 7.4.0.

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

No branches or pull requests

1 participant