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

Add generic typehints in PHPDoc #11066

Closed
GuySartorelli opened this issue Nov 23, 2023 · 2 comments
Closed

Add generic typehints in PHPDoc #11066

GuySartorelli opened this issue Nov 23, 2023 · 2 comments

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Nov 23, 2023

We should add PHPDoc typehints for generics where appropriate, to improve DX and type safety.

Potentially Handy Links

Acceptance criteria

  • Don’t use phpstan/psalm prefixes (i.e. use @return and @param directly)
  • Don't use any conditional return types
  • Add generic typehints for all list implementations
  • Add generic typehints for injector get(), create(), and any other methods where it would be relevant for injector
    • NOTE: Not for Injectable - i.e. DataObject::create() should just return static which it already does.
  • Add generic typehints for methods which return different objects based on a classname that's passed in
    • e.g. GridFieldConfig::getComponentByType()
    • e.g. SapphireTest::objFromFixture()
  • spend a little bit of time to see if there are other quick wins we can get by introducing generics.

Notes

PRs

@maxime-rainville maxime-rainville added this to the Silverstripe CMS 5.2 milestone Nov 23, 2023
This was referenced Jan 10, 2024
@emteknetnz
Copy link
Member

I reviewed up to and including recipe-cms

@emteknetnz
Copy link
Member

I reviewed up to and including login-forms

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

No branches or pull requests

3 participants