symplify/parameter-name-guard

此包已被废弃且不再维护。未建议替代包。

防止参数拼写错误导致应用程序无法正常运行

资助包维护!
tomasvotruba

安装次数: 902,108

依赖者: 0

建议者: 0

安全性: 0

星标: 9

关注者: 1

分支: 0

类型:symfony-bundle

v8.2.1 2020-08-07 20:33 UTC

README

Downloads total

防止参数拼写错误导致应用程序无法正常运行。

安装

composer require symplify/parameter-name-guard

注册包

# config/bundles.php
return [
    Symplify\ParameterNameGuard\Bundle\ParameterNameGuardBundle::class => ['all' => true],
];

使用

防止参数拼写错误

是不是 ignoreFiles?还是 ignored_files?或者 ignore_file?你懒得阅读每个 README.md 来找到正确的名称?通过帮助他们,让开发者们的生活更加愉快。

# app/config/services.yaml
parameters:
    correctKey: 'value'

    # you need to get just this one right :D
    correct_to_typos:
        # correct key name
        correct_key:
            # the most common typos that people make
            - 'correctKey'

            # regexp also works!
            - '#correctKey(s)?#i'

这样,用户会通过异常了解到他们犯的每一个拼写错误

Parameter "parameters > correctKey" does not exist.
Use "parameters > correct_key" instead.

他们可以少花时间记住所有键,更多时间进行编程。