Skip to content

Array shape #24

Description

@mabar
final class Example extends MappedObject {

	/** @var array{foo: string, bar: string} */
	#[AllOf([
		new ArrayShape([
			'foo' => new StringValue(),
			'bar' => new MixedValue()
		]),
		new ArrayShape([
			'bar' => new StringValue(),
		], allowExtraProps: true),
	])]
	public array $merged;

	/** @var array{foo: string, bar: string} */
	#[AllOf([
		new ArrayShape(FullObject::class),
		new ArrayShape(PartialObject::class, allowExtraProps: true),
	])]
	public array $merged2;

}
$processor->process([
	'merged' => [
		'foo' => 'string',
		'bar' => 'string',
	],
	'merged2' => [
		'foo' => 'string',
		'bar' => 'string',
	],
], Example::class);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions