Error control operator should be added to deprecation notices and/or removed from other cases.
Risky because adding/removing @
might cause changes to code behaviour or if
trigger_error
function is overridden.
Whether to add @
in deprecation notices.
Allowed types: bool
Default value: true
Whether to remove @
in remaining usages.
Allowed types: bool
Default value: false
List of global functions to exclude from removing @
.
Allowed types: list<string>
Default value: []
Default configuration.
--- Original
+++ New
<?php
-trigger_error('Warning.', E_USER_DEPRECATED);
+@trigger_error('Warning.', E_USER_DEPRECATED);
With configuration: ['noise_remaining_usages' => true]
.
--- Original
+++ New
<?php
-@mkdir($dir);
-@unlink($path);
+mkdir($dir);
+unlink($path);
With configuration: ['noise_remaining_usages' => true, 'noise_remaining_usages_exclude' => ['unlink']]
.
--- Original
+++ New
<?php
-@mkdir($dir);
+mkdir($dir);
@unlink($path);
The rule is part of the following rule sets:
- Fixer class: PhpCsFixer\Fixer\LanguageConstruct\ErrorSuppressionFixer
- Test class: PhpCsFixer\Tests\Fixer\LanguageConstruct\ErrorSuppressionFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.