ObjectTypeTest::createType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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