for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Pluswerk\TypoScriptAutoFixer\Fixer;
use Pluswerk\TypoScriptAutoFixer\Exception\FixerNotFoundException;
use Pluswerk\TypoScriptAutoFixer\Fixer\EmptySection\EmptySectionFixer;
use Pluswerk\TypoScriptAutoFixer\Fixer\NestingConsistency\NestingConsistencyFixer;
use Pluswerk\TypoScriptAutoFixer\Fixer\Indentation\IndentationFixer;
use Pluswerk\TypoScriptAutoFixer\Fixer\OperatorWhitespace\OperatorWhitespaceFixer;
use Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue;
use Pluswerk\TypoScriptAutoFixer\Issue\EmptySectionIssue;
use Pluswerk\TypoScriptAutoFixer\Issue\IndentationIssue;
use Pluswerk\TypoScriptAutoFixer\Issue\NestingConsistencyIssue;
use Pluswerk\TypoScriptAutoFixer\Issue\OperatorWhitespaceIssue;
class FixerFactory
{
/**
* @param AbstractIssue $issue
*
* @return FixerInterface|null
*/
public function getFixerByIssue(AbstractIssue $issue): ?FixerInterface
switch (get_class($issue)) {
case OperatorWhitespaceIssue::class:
return new OperatorWhitespaceFixer();
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
case IndentationIssue::class:
return new IndentationFixer();
case EmptySectionIssue::class:
return new EmptySectionFixer();
case NestingConsistencyIssue::class:
return new NestingConsistencyFixer();
}
throw new FixerNotFoundException('Fixer for issue ' . get_class($issue) . ' not found');
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.