flow-development-collection
flow-development-collection copied to clipboard
Validator fails if class properties of parameter are not using @var annotations
Steps to Reproduce
Given, there is an action as part of an Action Controller which expects an object as its argument:
/**
* @param MyValueObject $myValueObject
*/
public function someAction(MyValueObject $myValueObject): string
{ … }
The object's constructor uses a promoted property ($theValue):
final class MyValueObject
{
protected function __construct(readonly public string $theValue)
{
}
public static function fromString(string $theValue): MyValueObject
{
return new MyValueObject($theValue);
}
}
Expected behavior
The validator checking the arguments for the given action method should accept the value object.
Actual behavior
The validator fails with the following exception:
Exception 1363778104: There is no @var annotation for property "theValue" in class "…\MyValueObject"
Affected Versions
Flow: All currently active versions which should support PHP 7.4 (Flow 5.3 and higher)
The fix is currently only present in the 5.3 branch, not yet upmerged to later releases.