mark-gerarts / phpstan-automapper-plus
AutoMapper+ 的 PHPStan 配置
0.1.0
2019-08-08 18:41 UTC
This package is auto-updated.
Last update: 2024-09-15 03:13:53 UTC
README
此包提供了 AutoMapper+ 的配置。它作为对 此问题 中描述的问题的解决方案。
背景
基本上,我们在 MapperInterface
的 map
方法中引入了一个第三个参数($context
)。这是在 1.0 版本发布之后引入的,为了防止引入破坏性变更,接口没有显式地包含 $context
参数。它将在 2.0 版本中显式添加。
但是,在此期间,如果你在代码中使用它,PHPStan 将会抱怨缺少参数。信息将类似于以下内容
Method AutoMapperPlus\MapperInterface::map() invoked with 3 parameters, 2 required.
此包抑制这些错误。
使用和安装
此包随基础库自动安装。要启用它,有 2 个选项
- 使用 phpstan/extension-installer。这将自动注册扩展。
- 手动注册配置。
includes: - vendor/mark-gerarts/phpstan-automapper-plus/phpstan.neon