waaseyaa/typed-data

Type system with PHP-native facade for Waaseyaa

Maintainers

Package info

github.com/waaseyaa/typed-data

pkg:composer/waaseyaa/typed-data

Statistics

Installs: 5 888

Dependents: 5

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0-alpha.158 2026-04-10 00:55 UTC

This package is auto-updated.

Last update: 2026-04-24 22:20:44 UTC


README

Layer 0 — Foundation

Typed data validation and coercion for Waaseyaa applications.

Provides a type system for field and entity-adjacent values. EntityCastCoercion (Waaseyaa\TypedData\Coercion\EntityCastCoercion) is the canonical implementation for entity $casts builtins int, float, bool, string, and array (JSON string in storage): strict storage→domain and domain→storage rules shared with waaseyaa/entity ValueCaster (#1185). Failures throw CoercionException, which ValueCaster wraps as CastException for a single error model at the entity boundary.

CastTokenMapper maps entity cast tokens to TypedDataManager dataType strings (intinteger, etc.). Tokens array / json return null because JSON bags are not map/list without a schema.

Primitive types (IntegerData, FloatData, BooleanData, StringData) use getCastedValue() via the same coercion rules as entities (aligned with ValueCaster).

Symfony Validator applies DataDefinition constraints on the raw getValue() bag; coercion (EntityCastCoercion / getCastedValue) is separate from constraint validation—run both when you need normalized types and business rules.

Used by the field system (FieldItemBase, PropertyValue) and by entity casting (#1185).

Key classes: TypedDataInterface, DataDefinition, TypedDataManager, EntityCastCoercion, CastTokenMapper.