Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Latest commit

 

History

History
52 lines (37 loc) · 1.25 KB

README.md

File metadata and controls

52 lines (37 loc) · 1.25 KB

Package Builder

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.