AFAIK is not possibile to use arrow function in the new PHP 8.5 first-class callables. This extension suggest to do so:
#[Assert\When(
expression: static function (self $o) { return $o->isFullDay; }, // Here PHP7103 suggests to use arrow fn
constraints: new Assert\IsNull(),
otherwise: new Assert\NotNull())
]
public ?Time $startTime = null;
But....
Fatal error: Constant expression contains invalid operations.
#[Assert\When(
expression: static fn (self $o) => $o->isFullDay,
constraints: new Assert\IsNull(),
otherwise: new Assert\NotNull())
]
public ?Time $startTime = null;
AFAIK is not possibile to use arrow function in the new PHP 8.5 first-class callables. This extension suggest to do so:
But....