- Added support for closure in Virtual field
This commit is contained in:
1 parent
756474d460
commit
a4b81f1932
2 files changed
+26
-10
No files matched your search
@@ -8,6 +8,14 @@ class Virtual extends Field {
|
||||
public bool $readonly = true;
|
||||
|
||||
public function __construct(
|
||||
public ? string $method = null,
|
||||
) {}
|
||||
public null|string|array $method = null,
|
||||
public ? \Closure $closure = null,
|
||||
) {
|
||||
$this->method ??= [ static::class, 'noop' ];
|
||||
}
|
||||
|
||||
public static function noop() : null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user