Components

Learn how to reference the content type of a component.

This interface holds a named content type for each Component, generated by the CLI in the Croct\Content namespace. Each type is named after its component in PascalCase, where the bare name resolves to the latest version and a V<major> suffix targets a specific major.

Example

Supposing you have a component named card with versions 1 and 2, this interface exposes Card for the latest version (currently version 2), CardV1 for version 1, and CardV2 for version 2.

To annotate your own code, import a type with @phpstan-import-type and @psalm-import-type:

<?php/** * @phpstan-import-type Card from \Croct\Content\Components * @psalm-import-type Card from \Croct\Content\Components */final class CardView{    /** @var Card */    public array $card;}