EmptySectionFixer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fixIssue() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Pluswerk\TypoScriptAutoFixer\Fixer\EmptySection;
5
6
use Pluswerk\TypoScriptAutoFixer\File;
7
use Pluswerk\TypoScriptAutoFixer\Fixer\AbstractFixer;
8
use Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue;
9
use Pluswerk\TypoScriptAutoFixer\Issue\EmptySectionIssue;
10
11
final class EmptySectionFixer extends AbstractFixer
12
{
13
14
    /**
15
     * @param File          $file
16
     * @param AbstractIssue|EmptySectionIssue $issue
17
     *
18
     * @return File
19
     */
20
    public function fixIssue(File $file, AbstractIssue $issue): File
21
    {
22
        $lines = range($issue->startLine(), $issue->endLine());
0 ignored issues
show
Bug introduced by
The method startLine() does not exist on Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue. It seems like you code against a sub-type of Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue such as Pluswerk\TypoScriptAutoF...Issue\EmptySectionIssue. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $lines = range($issue->/** @scrutinizer ignore-call */ startLine(), $issue->endLine());
Loading history...
Bug introduced by
The method endLine() does not exist on Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue. It seems like you code against a sub-type of Pluswerk\TypoScriptAutoFixer\Issue\AbstractIssue such as Pluswerk\TypoScriptAutoF...Issue\EmptySectionIssue. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $lines = range($issue->startLine(), $issue->/** @scrutinizer ignore-call */ endLine());
Loading history...
23
        $file->removeLines($lines);
24
        $file = $this->fileBuilder->buildFile($file->getPathname());
25
        return $file;
26
    }
27
}
28