You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
silverstripe/silverstripe-framework#11066 introduced generic typehints in a bunch of places. We should have a CI check to ensure code changes don't deteriorate this level of type hinting.
While it would be awesome to have CI check that the correct type is being hinted, the most important part is that a type is hinted. We don't have any CI checking for correct types right now, so adding that is out of scope for this card unless it's trivial.
Acceptance criteria
CI rules are added using a standardised tool (e.g. PHPStan or PHPCodeSniffer)
All subclasses of ContentController, Extension, and implementations of SS_List have a @extends PHPDoc annotation if the class they're a direct subclass of uses a @template annotation
If the type in the @extends annotation is a generic type, there is a corresponding @template annotation
Methods which return an implementation of SS_List include a generic hint (e.g. instead of just @return DataList it should be @return DataList<SomeDataModel>
Classes mentioned in annotations must either be in the same namespace as the class referencing them, or have a use statement
The text was updated successfully, but these errors were encountered:
silverstripe/silverstripe-framework#11066 introduced generic typehints in a bunch of places. We should have a CI check to ensure code changes don't deteriorate this level of type hinting.
Related
Notes
Acceptance criteria
ContentController
,Extension
, and implementations ofSS_List
have a@extends
PHPDoc annotation if the class they're a direct subclass of uses a@template
annotation@extends
annotation is a generic type, there is a corresponding@template
annotationSS_List
include a generic hint (e.g. instead of just@return DataList
it should be@return DataList<SomeDataModel>
use
statementThe text was updated successfully, but these errors were encountered: