-
Notifications
You must be signed in to change notification settings - Fork 2
Releases: php-type-language/mapper
Releases · php-type-language/mapper
0.5.0
0.5.0
Pre-release
Pre-release
- Added asymmetric read/write support for reflection driver:
class Example { // The mapper inferences: // - Type "string" for reading (normalization) // - Type "string|\Stringable" for writing (denormalization) public string $name { get => $this->name; set(string|\Stringable $name) => (string) $name; } }
- Added asymmetric read/write support for attribute driver:
class Example { #[MapType('T')] // Inferences T for read + write public string $name { #[MapType('U')] // Inferences T for reading (normalization) get => $this->name; #[MapType('V')] // Inferences V for writing (denormalization) set(string|\Stringable $name) => (string) $name; } }
- Added support for custom error messages:
class Example { #[OnTypeError(message: 'Name must be a string')] #[OnUndefinedError(message: 'Name is required')] public string $name; } // If specified via configs: // 'properties' => [ // 'name' => [ // 'type_error_message' => 'Name must be a string', // 'undefined_error_message' => 'Name is required', // ], // ...
- In case of empty object received, an error is now thrown indicating that it is an object
{}, not an array[]as before. - And more...
Full Changelog: 0.4.1...0.5.0
Assets 2
0.4.1
0.4.1
Pre-release
Pre-release
- Fix class inheritance
- Actualize and fix linter issues
Full Changelog: 0.4.0...0.4.1
Assets 2
0.4.0
0.4.0
Pre-release
Pre-release
- Added CallableTypeBuilder (see: #1)
- Added support of TypeLang v1.4
- Added stricter class type checks
New Contributors
Full Changelog: 0.3.0...0.4.0
Assets 2
0.3.0
0.3.0
Pre-release
Pre-release
- Added objects subtype normalization.
- Added
Mapper::getType()andMapper::getTypeByValue()public methods. - Added array-like metadata drivers (with JSON Schema validation).
- A little more improvements
Full Changelog: 0.2.0...0.3.0
Assets 2
1 person reacted
0.2.0
0.2.0
Pre-release
Pre-release
Features
- Added discriminator mapping (see
#[DiscriminatorMap]attribute). - Added property name mapping (see
#[MapName]attribute). - Added localobject "normalize as array" option (see
#[NormalizeAsArray]attribute). - Added object normalization property skipping options:
- See
#[SkipWhen]for using skipping expressions. - See
#[SkipWhenEmpty]forempty(T)skipping expression. - See
#[SkipWhenNull]forT === nullskipping expression.
- See
- The
#[MapProperty]attribute renamed to#[MapType]. - Added debug tracing and logging options.
- Use
Configuration::$loggeroption for logger. - Use
Configuration::$traceroption for tracing.
- Use
- Added value casting: Values for normalization are now trusted by default and attempt to convert to the specified type, instead of strictly checking.
See https://github.com/php-type-language/mapper/tree/master/tests/Feature/Type files for more information on the casting rules.
- Use
Configuration::$strictTypesoption to enable or disable casting mode.
- Use
Types
- Added
booleanalias ofbooltype. - Added
integeralias ofinttype. - Added
doubleandrealaliases offloattype. - Added
iterable,Iterator,Generator,TraversableandIteratorAggregatealiases forarraynormalization. - Added
objectandstdClasstypes. - Added
UnitEnumTypesupport. - Temporary removed non-standard
non-empty-string,numeric-string,class-string,positive-int,non-negative-int,negative-intandnon-positive-int. Please temporarily add aliases to thestringandintfor them.
Other
- All runtime (mapping) exceptions and their hierarchy have been rewritten.
- All kernel have been rewritten (there are too many changes to list it all).
Full Changelog: 0.1.0...0.2.0
Assets 2
0.1.0
0.1.0
Pre-release
Pre-release
Please note, this is a pre-release to freeze the stable version, prepare documentation and evaluate the functionality.
Please wait for the major version
1.0.0if you want to use it in production.
There may be backward compatibility breaks between minor versions0.x!
Assets 2
1 person reacted