Viewing file: DeadCodeAnalyzer.php (1.29 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Enlightn\Enlightn\Analyzers\Reliability;
use Enlightn\Enlightn\Analyzers\Concerns\ParsesPHPStanAnalysis; use Enlightn\Enlightn\PHPStan;
class DeadCodeAnalyzer extends ReliabilityAnalyzer { use ParsesPHPStanAnalysis;
/** * The title describing the analyzer. * * @var string|null */ public $title = 'Your application does not contain any dead or unreachable code.';
/** * The severity of the analyzer. * * @var string|null */ public $severity = self::SEVERITY_MINOR;
/** * The time to fix in minutes. * * @var int|null */ public $timeToFix = 10;
/** * Get the error message describing the analyzer insights. * * @return string */ public function errorMessage() { return "Your application contains some dead or unreachable code. It is good practice to delete all unreachable " ."code so as to improve code readability."; }
/** * Execute the analyzer. * * @param \Enlightn\Enlightn\PHPStan $phpStan * @return void */ public function handle(PHPStan $phpStan) { $this->parsePHPStanAnalysis($phpStan, [ 'does not do anything', 'Unreachable statement', 'is unused', 'Empty array passed', ]); } }
|