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 (#65)
by
unknown
02:16
created

FloatType::parse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Minime\Annotations\Types;
4
5
use Minime\Annotations\ParserException;
6
7
class FloatType extends AbstractType
8
{
9
    /**
10
     * @var TypeInterface
11
     */
12
    private static $instance;
13
14
    public static function getType()
15
    {
16
        if (!isset(self::$instance)) {
17
            self::$instance = new FloatType();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Minime\Annotations\Types\FloatType() of type object<Minime\Annotations\Types\FloatType> is incompatible with the declared type object<Minime\Annotations\Types\TypeInterface> of property $instance.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
18
        }
19
20
        return self::$instance;
0 ignored issues
show
Bug Compatibility introduced by
The expression self::$instance; of type Minime\Annotations\Types...ons\Types\TypeInterface adds the type Minime\Annotations\Types\TypeInterface to the return on line 20 which is incompatible with the return type declared by the abstract method Minime\Annotations\Types\AbstractType::getType of type Minime\Annotations\Interfaces\TypeInterface.
Loading history...
21
    }
22
23
    /**
24
     * Filter a value to be a Float
25
     *
26
     * @param  string                              $value
27
     * @param  null                                $annotation Unused
28
     * @throws \Minime\Annotations\ParserException
29
     * @return float
30
     */
31
    public function parse($value, $annotation = null)
32
    {
33
        if (false === ($value = filter_var($value, FILTER_VALIDATE_FLOAT))) {
34
            throw new ParserException("Raw value must be float. Invalid value '{$value}' given.");
35
        }
36
37
        return $value;
38
    }
39
40
}
41