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
If you use stricter scalars like non-empty-string, then you could even do:
'write_property_path' => function (Foo$foo, string$bar) {
if ('' === $bar) {
// this exception turns into validation errorthrownewTransformationFailedException(invalidMessage: 'Empty string not allowed');
}
// psalm now knows $bar is non-empty-string here$foo->setBar($bar);
}
'write_property_path' => function (Foo$foo, string$bar) {
FormAssert::stringNotEmpty($bar);
$foo->setBar($bar);
}
It can be PITA to write these, but you get ctrl+click navigation to where getter/setter are used. And if any typehint is wrong, like some data transformer goes unexpected, then you will get validation error instead of 500.
Psalm is reporting:
...even though I have a Symfony form which is bound to
Foo
, and contains a fieldbar
.The text was updated successfully, but these errors were encountered: