/**
* @psalm-type ValidPayload = array{
* field1: int<1, 365>,
* field2: non-empty-string,
* field3: list<non-empty-string>,
* }
* @extends Form<ValidPayload>
*/
final class MyForm extends Form
{
}
It's been a while since I used form for anything other than regular associative arrays, but given forms can be bound to objects too - it's also feasible that forms could be annotated to return models too, such as:
/** @extends Form<SomeModel> */
final class MyForm extends Form
{
}
The patch in InputFilter helps because users will be able to do something like the following:
/**
* @psalm-import-type ValidPayload from MyInputFilter
* @extends Form<ValidPayload>
*/
final class MyForm extends Form
{
public function __construct(MyInputFilter $inputFilter)
{
parent::__construct();
$this->setInputFilter($inputFilter);
}
}
Feature Request
Summary
With https://github.com/laminas/laminas-inputfilter/pull/91 landing in input-filter, it'll be easier to annotate forms with something like:
It's been a while since I used form for anything other than regular associative arrays, but given forms can be bound to objects too - it's also feasible that forms could be annotated to return models too, such as:
The patch in InputFilter helps because users will be able to do something like the following: