silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 820 forks source link

Strongly type FieldList #11198

Closed maxime-rainville closed 1 month ago

maxime-rainville commented 2 months ago

Many methods on FieldList will silently fail if you give them bad types.

e.g.: $fields->addFieldsToTab('Root.Main', $field1, $field2, $field3) will only add $field1 to the tab.

Acceptance criteria

Shared CI workflow run

PRs

GuySartorelli commented 2 months ago

FieldList is not in a vacuum - it's the subclass of ArrayList which is a subclass of ViewableData, uses a trait, and implements several interfaces.

The ACs should specify whether any of that is in scope, or if this card is only for methods defined directly in FieldList, or if it's mostly about methods defined directly in FieldList but the implementor can choose to strongly-type other methods if they feel it's relevant to the goal of the card (i.e. making it clearer what can/cannot be passed into FieldList).

GuySartorelli commented 1 month ago

PRs merged