symplify/parameter-name-guard

This package is abandoned and no longer maintained. No replacement package was suggested.

Prevent silent parameter typos that silently break your app

Fund package maintenance!
tomasvotruba

Installs: 904 195

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 1

Forks: 0

Type:symfony-bundle

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

README

Downloads total

Prevent parameter typos that silently break your app.

Install

composer require symplify/parameter-name-guard

Register bundle:

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

Use

Prevent Parameter Typos

Was it ignoreFiles? Or ignored_files? Or ignore_file? Are you lazy to read every README.md to find out the correct name? Make developers' live happy by helping them.

# 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'

This way user is informed on every typo he or she makes via exception:

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

They can focus less on remembering all the keys and more on programming.