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
Push — master ( 3e29f4...a0257c )
by Gytis
03:40 queued 11s
created

FqcnPropSniff   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A reportInvalidDescription() 0 6 3
A configure() 0 2 1
A register() 0 5 1
A process() 0 12 1
1
<?php
2
3
namespace Gskema\TypeSniff\Sniffs\CodeElement;
4
5
use Gskema\TypeSniff\Inspection\DocTypeInspector;
6
use Gskema\TypeSniff\Inspection\Subject\PropTypeSubject;
7
use PHP_CodeSniffer\Files\File;
8
use Gskema\TypeSniff\Core\CodeElement\Element\AbstractFqcnPropElement;
9
use Gskema\TypeSniff\Core\CodeElement\Element\ClassPropElement;
10
use Gskema\TypeSniff\Core\CodeElement\Element\CodeElementInterface;
11
use Gskema\TypeSniff\Core\CodeElement\Element\TraitPropElement;
12
13
class FqcnPropSniff implements CodeElementSniffInterface
14
{
15
    protected const CODE = 'FqcnPropSniff';
16
17
    /**
18
     * @inheritDoc
19
     */
20 6
    public function configure(array $config): void
21
    {
22
        // nothing to do
23 6
    }
24
25
    /**
26
     * @inheritDoc
27
     */
28 6
    public function register(): array
29
    {
30
        return [
31 6
            ClassPropElement::class,
32
            TraitPropElement::class,
33
        ];
34
    }
35
36
    /**
37
     * @inheritDoc
38
     * @param AbstractFqcnPropElement $prop
39
     */
40 4
    public function process(File $file, CodeElementInterface $prop): void
41
    {
42 4
        $subject = PropTypeSubject::fromElement($prop);
43
44 4
        DocTypeInspector::reportMandatoryTypes($subject);
45 4
        DocTypeInspector::reportReplaceableTypes($subject);
46 4
        DocTypeInspector::reportRemovableTypes($subject);
47 4
        DocTypeInspector::reportMissingOrWrongTypes($subject);
48
49 4
        static::reportInvalidDescription($subject);
50
51 4
        $subject->writeWarningsTo($file, static::CODE);
52 4
    }
53
54 4
    protected static function reportInvalidDescription(PropTypeSubject $subject): void
55
    {
56 4
        $varTag = $subject->getDocBlock()->getTagsByName('var')[0] ?? null;
57
58 4
        if ($varTag && null !== $varTag->getParamName()) {
59 1
            $subject->addDocTypeWarning('Remove property name $'.$varTag->getParamName().' from @var tag');
60
        }
61 4
    }
62
}
63