GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#214)
by joseph
16:19
created

ReplaceTypeHintsProcess   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
dl 0
loc 39
ccs 0
cts 15
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A run() 0 11 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Process;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\CodeHelper;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File;
7
8
class ReplaceTypeHintsProcess implements ProcessInterface
9
{
10
    /**
11
     * @var CodeHelper
12
     */
13
    private $codeHelper;
14
    /**
15
     * @var string
16
     */
17
    private $mappingHelperType;
18
    /**
19
     * @var bool
20
     */
21
    private $nullable;
22
    /**
23
     * @var string
24
     */
25
    private $phpType;
26
27
    public function __construct(CodeHelper $codeHelper, string $phpType, string $mappingHelperType, $defaultValue)
28
    {
29
        $this->codeHelper        = $codeHelper;
30
        $this->phpType           = $phpType;
31
        $this->mappingHelperType = $mappingHelperType;
32
        $this->nullable          = (null === $defaultValue);
33
34
    }
35
36
    public function run(File\FindReplace $findReplace): void
37
    {
38
        $file     = $findReplace->getFile();
39
        $contents = $file->getContents();
40
        $contents = $this->codeHelper->replaceTypeHintsInContents(
41
            $contents,
0 ignored issues
show
Bug introduced by
It seems like $contents can also be of type null; however, parameter $contents of EdmondsCommerce\Doctrine...ceTypeHintsInContents() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

41
            /** @scrutinizer ignore-type */ $contents,
Loading history...
42
            $this->phpType,
43
            $this->mappingHelperType,
44
            $this->nullable
45
        );
46
        $file->setContents($contents);
47
    }
48
}
49