mark-gerarts/phpstan-automapper-plus

AutoMapper+ 的 PHPStan 配置

安装量: 4,248

依赖者: 1

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 1

公开问题: 2

类型:phpstan-extension

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+ 的配置。它作为对 此问题 中描述的问题的解决方案。

背景

基本上,我们在 MapperInterfacemap 方法中引入了一个第三个参数($context)。这是在 1.0 版本发布之后引入的,为了防止引入破坏性变更,接口没有显式地包含 $context 参数。它将在 2.0 版本中显式添加。

但是,在此期间,如果你在代码中使用它,PHPStan 将会抱怨缺少参数。信息将类似于以下内容

Method AutoMapperPlus\MapperInterface::map() invoked with 3 parameters, 2 required. 

此包抑制这些错误。

使用和安装

此包随基础库自动安装。要启用它,有 2 个选项

includes:
    - vendor/mark-gerarts/phpstan-automapper-plus/phpstan.neon