Passed
Push — phpstan-tests ( 6a2b78...974220 )
by Michael
61:35 queued 23s
created

TypeTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaultTypesAreRegistered() 0 3 1
A defaultTypesProvider() 0 8 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Types;
6
7
use Doctrine\DBAL\Types\Type;
8
use PHPUnit\Framework\TestCase;
9
use ReflectionClass;
10
11
class TypeTest extends TestCase
12
{
13
    /**
14
     * @dataProvider defaultTypesProvider()
15
     */
16
    public function testDefaultTypesAreRegistered(string $name) : void
17
    {
18
        self::assertTrue(Type::hasType($name));
19
    }
20
21
    /**
22
     * @return string[][]
23
     */
24
    public function defaultTypesProvider() : iterable
25
    {
26
        foreach ((new ReflectionClass(Type::class))->getReflectionConstants() as $constant) {
27
            if (! $constant->isPublic()) {
28
                continue;
29
            }
30
31
            yield [$constant->getValue()];
0 ignored issues
show
Bug Best Practice introduced by
The expression yield array($constant->getValue()) returns the type Generator which is incompatible with the documented return type array<mixed,string[]>.
Loading history...
32
        }
33
    }
34
}
35