Skip to content

savinmikhail/symfony-translatable-exceptions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

composer require --dev savinmikhail/symfony-translatable-exceptions

Usage

In your psalm.xml add the following lines

    <plugins>
        <pluginClass class="SavinMikhail\TranslatableExceptionsPlugin\Plugin"/>
    </plugins>

Output

ERROR: InvalidArgument - src/Service/Extractor/WhlExtractor.php:33:40 - Avoid hardcoding exception messages, use a translation mechanism instead. (see https://psalm.dev/004)
            throw new RuntimeException('File upload required.');

To fix this, we need to use

throw new RuntimeException(this->translator->trans('error.file_upload_required'));

About

Psalm plugin, to make sure all exceptions' messages were translated

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages