classes/Blueprints/Schema/Field.php
<?php
namespace Bnomei\Blueprints\Schema;
use Bnomei\Blueprints\HasFluentGetter;
use Bnomei\Blueprints\HasFluentSetter;
use Bnomei\Blueprints\HasProperties;
use Bnomei\Blueprints\HasStaticMake;
use JsonSerializable;
/**
* @method self type(FieldTypes|string $type)
* @method self id(string|null $id)
* @method self label(array|string|null $label)
* @method self width(float|string|null $width)
* @method self extends(string|null $extends)
* @method self property(string $name, mixed $value)
* @method self properties(array $properties)
*/
class Field implements JsonSerializable
{
use HasFluentGetter;
use HasFluentSetter;
use HasProperties;
use HasStaticMake;
public mixed $type = null;
public function __construct(
mixed $type = null,
public ?string $id = null,
public string|array|null $label = null,
public array $properties = [],
public string|float|null $width = null,
public ?string $extends = null,
) {
$this->type ??= $type; // allow override from inheriting class
}
}