更新日志 0.15.0 — 2022 年 10 月 6 日¶
重要变更¶
此版本中引入了两个类似的功能:常量和枚举通配符表示法。当枚举或类常量的几种情况共享公共前缀时,这主要有用。
类常量示例:
final class SomeClassWithConstants
{
public const FOO = 1337;
public const BAR = 'bar';
public const BAZ = 'baz';
}
$mapper = (new MapperBuilder())->mapper();
$mapper->map('SomeClassWithConstants::BA*', 1337); // error
$mapper->map('SomeClassWithConstants::BA*', 'bar'); // ok
$mapper->map('SomeClassWithConstants::BA*', 'baz'); // ok
枚举示例:
enum SomeEnum: string
{
case FOO = 'foo';
case BAR = 'bar';
case BAZ = 'baz';
}
$mapper = (new MapperBuilder())->mapper();
$mapper->map('SomeEnum::BA*', 'foo'); // error
$mapper->map('SomeEnum::BA*', 'bar'); // ok
$mapper->map('SomeEnum::BA*', 'baz'); // ok
新功能¶
错误修复¶
- 添加缓存实现的返回类型( 0e8f12 )
- 在映射期间正确处理类型推断 ( 37f96f )
- 为子节点获取正确的节点值( 3ee526 )
- 改进标量值转换 ( 212b77 )
- 正确处理静态匿名函数( c009ab )