Automattic\WooCommerce\Api\Attributes
Parameter::__construct
Constructor.
Method of the class: Parameter{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Parameter = new Parameter(); $Parameter->__construct( readonly string $name = '', readonly string $type = '', readonly bool $nullable = false, readonly bool $array = false, readonly mixed $default = null, readonly string $description = '', bool $has_default = false, readonly bool $unroll = false, );
- public readonly string $name
- .
Default:'' - public readonly string $type
- .
Default:'' - public readonly bool $nullable
- .
Default:false - public readonly bool $array
- .
Default:false - public readonly mixed $default
- .
Default:null - public readonly string $description
- .
Default:'' - $has_default(true|false)
- Set to true to explicitly indicate a default is provided (needed when the default value is null).
Default:false - public readonly bool $unroll
.
Default:false(required)
- .
Parameter::__construct() Parameter:: construct code WC 10.9.1
public function __construct(
public readonly string $name = '',
public readonly string $type = '',
public readonly bool $nullable = false,
public readonly bool $array = false,
public readonly mixed $default = null,
public readonly string $description = '',
bool $has_default = false,
public readonly bool $unroll = false,
) {
// We need a separate flag because null could be a valid default value.
// Callers pass has_default: true when they supply a default, or we infer
// it from the default value being non-null.
$this->has_default = $has_default || null !== $default;
}