Const-backed identity getters for {@see \LaravelUi5\Core\Ui5\Contracts\Ui5ArtifactInterface}.
Keystone ② of the Core 1.0 acceptance work. The four meta attributes are frozen, intrinsic identity — so they stay interface methods (the contract the registry reads polymorphically on every route resolution), but their value is declared once as a class constant. A concrete artifact declares only:
public const string NAMESPACE = 'io.example.foo'; public const string VERSION = '1.0.0'; public const string TITLE = 'Foo'; public const string DESCRIPTION = 'A foo artifact.';
and inherits the getters from its abstract base (which uses this trait).
A trait, not a shared base: there is no shared artifact parent, and
AbstractUi5App extends ODataService already spends PHP's single-inheritance
slot — a trait is inheritance-neutral and applies uniformly.
static::, not self::: late static binding reads the concrete class's
constant, not the base's. This is also what makes the trait
backward-compatible — a concrete that still hand-writes a getter simply
overrides the trait method, so existing artifacts keep working untouched and
migration is never forced.
Convention, not enforcement: PHP has no abstract constant. A concrete that
declares neither the constant nor an overriding getter raises a clear
Error: Undefined constant …::NAMESPACE at the first getter call — loud and
immediate. Artifacts are generator-authored (the ui5:* stubs emit the
constants), so the constants are present in practice; the reflection-check
ceremony the language community itself won't bless is not worth its weight.
| Methods | ||
|---|---|---|
public
|
getNamespace(): string
|
# |
public
|
getVersion(): string
|
# |
public
|
getTitle(): string
|
# |
public
|
getDescription(): string
|
# |