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.

ValidateAnnotationHandler   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 77.27%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 17
cts 22
cp 0.7727
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
B __invoke() 0 27 6
1
<?php
2
3
namespace PhpBoot\Entity\Annotations;
4
5
use PhpBoot\Annotation\AnnotationBlock;
6
use PhpBoot\Annotation\AnnotationTag;
7
use PhpBoot\Entity\EntityContainer;
8
use PhpBoot\Exceptions\AnnotationSyntaxException;
9
use PhpBoot\Utils\AnnotationParams;
10
use PhpBoot\Validator\Validator;
11
12
class ValidateAnnotationHandler
13
{
14
    /**
15
     * @param EntityContainer $container
16
     * @param AnnotationBlock|AnnotationTag $ann
17
     * @return void
18
     */
19 3
    public function __invoke(EntityContainer $container, $ann)
20
    {
21 3
        $params = new AnnotationParams($ann->description, 3);
22 3
        if($params->count()){
23
24 3
            $target = $ann->parent->name;
25 3
            $property = $container->getProperty($target);
26 3
            $property or \PhpBoot\abort($container->getClassName()." property $target not exist ");
27 3
            if($params->count()>1){
28 1
                $property->validation = [$params->getParam(0), $params->getParam(1)];
29 1
            }else{
30 2
                $property->validation = $params->getParam(0);
31 2
                if($property->validation){
32 2
                    $v = new Validator();
33 2
                    $v->rule($property->validation, $property->name);
0 ignored issues
show
Documentation introduced by
$property->validation is of type *, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
34 2
                    if($v->hasRule('optional', $property->name)){
35
                        $property->isOptional = true;
36
                    }
37 2
                }
38
            }
39
40 3
        }else{
41
            \PhpBoot\abort(new AnnotationSyntaxException(
42
                "The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::{$ann->parent->name} require 1 param, 0 given"
43
            ));
44
        }
45
    }
46
}