EmptySectionFixer::fixIssue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
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