The expression return $this returns the type SilverStripe\UserForms\F...UserFormsCompositeField which is incompatible with the return type mandated by SilverStripe\UserForms\F...ontainer::processNext() of SilverStripe\UserForms\F...\EditableContainerField.
In the issue above, the returned value is violating the contract defined by the
mentioned interface.
Let's take a look at an example:
interfaceHasName{/** @return string */publicfunctiongetName();}className{public$name;}classUserimplementsHasName{/** @return string|Name */publicfunctiongetName(){returnnewName('foo');// This is a violation of the ``HasName`` interface// which only allows a string value to be returned.}}
$formField of type SilverStripe\UserForms\Model\EditableFormField is incompatible with the type SilverStripe\Forms\FormField expected by parameter $field of SilverStripe\Forms\CompositeField::push().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
The expression return $formField->setParent($this) also could return the type SilverStripe\UserForms\M...UserFormsFieldContainer which is incompatible with the return type mandated by SilverStripe\UserForms\F...ontainer::processNext() of SilverStripe\UserForms\F...\EditableContainerField.
The method setParent() does not exist on SilverStripe\UserForms\Model\EditableFormField. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
The expression return $this returns the type SilverStripe\UserForms\F...UserFormsCompositeField which is incompatible with the return type mandated by SilverStripe\UserForms\F...ontainer::processNext() of SilverStripe\UserForms\F...\EditableContainerField.
In the issue above, the returned value is violating the contract defined by the
mentioned interface.
Let's take a look at an example:
interfaceHasName{/** @return string */publicfunctiongetName();}className{public$name;}classUserimplementsHasName{/** @return string|Name */publicfunctiongetName(){returnnewName('foo');// This is a violation of the ``HasName`` interface// which only allows a string value to be returned.}}
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: