savinmikhail / symfony-translatable-exceptions
Make sure there's no hardcoded exception messages, only translated ones
Installs: 104
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:psalm-plugin
Requires
- php: ^8.2
- ext-simplexml: *
- vimeo/psalm: ^5.16
Requires (Dev)
- codeception/codeception: ^4.1
- phpunit/phpunit: ^9.5.5
- psalm/plugin-phpunit: ^0.16.0
- squizlabs/php_codesniffer: ^3.3
- weirdan/codeception-psalm-module: ^0.13.1
- weirdan/prophecy-shim: ^2.0
README
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'));