ObjectTypeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 41
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testDescribe() 0 3 1
A createType() 0 3 1
validValidateValuesProvider() 0 5 ?
A hp$0 ➔ testAcceptsNull() 0 3 1
testAcceptsNull() 0 3 ?
A hp$0 ➔ validValidateValuesProvider() 0 5 1
A hp$0 ➔ invalidValidateValuesProvider() 0 9 1
invalidValidateValuesProvider() 0 9 ?
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\Annotations\Metadata\Type;
6
7
use DateTimeImmutable;
8
use Doctrine\Annotations\Metadata\Type\ObjectType;
9
use Doctrine\Annotations\Metadata\Type\Type;
10
use stdClass;
11
12
final class ObjectTypeTest extends TypeTest
13
{
14
    protected function createType() : Type
15
    {
16
        return new ObjectType('stdClass');
17
    }
18
19
    public function testDescribe() : void
20
    {
21
        self::assertSame(stdClass::class, $this->getType()->describe());
22
    }
23
24
    /**
25
     * @return object[][]
26
     */
27
    public function validValidateValuesProvider() : iterable
28
    {
29
        yield [new stdClass()];
0 ignored issues
show
Bug Best Practice introduced by
The expression yield array(new stdClass()) returns the type Generator which is incompatible with the documented return type array<mixed,array<mixed,object>>.
Loading history...
30
        yield [
31
            new class extends stdClass {
32
            },
33
        ];
34
    }
35
36
    /**
37
     * @return mixed[][]
38
     */
39
    public function invalidValidateValuesProvider() : iterable
40
    {
41
        yield [null];
0 ignored issues
show
Bug Best Practice introduced by
The expression yield array(null) returns the type Generator which is incompatible with the documented return type array<mixed,array<mixed,mixed>>.
Loading history...
42
        yield [true];
43
        yield [0];
44
        yield [0.0];
45
        yield ['0'];
46
        yield [[0]];
47
        yield [new DateTimeImmutable()];
48
    }
49
50
    public function testAcceptsNull() : void
51
    {
52
        self::assertFalse($this->getType()->acceptsNull());
53
    }
54
}
55