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

deprecated-packages/parameter-name-guard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.