DoctrineOrmExtension::loadTypeGuesser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2019 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Flange\Database\Doctrine\Form;
14
15
use Doctrine\Persistence\ObjectManager;
16
use Symfony\Component\Form\AbstractExtension;
17
use Symfony\Component\Form\FormTypeGuesserInterface;
18
19
class DoctrineOrmExtension extends AbstractExtension
20
{
21
    public function __construct(protected ObjectManager $registry)
22
    {
23
    }
24
25
    protected function loadTypes(): array
26
    {
27
        return [
28
            new Type\EntityType($this->registry),
29
        ];
30
    }
31
32
    protected function loadTypeGuesser(): ?FormTypeGuesserInterface
33
    {
34
        return new DoctrineOrmTypeGuesser($this->registry);
0 ignored issues
show
Bug introduced by
$this->registry of type Doctrine\Persistence\ObjectManager is incompatible with the type Doctrine\Persistence\ManagerRegistry expected by parameter $registry of Flange\Database\Doctrine...eGuesser::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

34
        return new DoctrineOrmTypeGuesser(/** @scrutinizer ignore-type */ $this->registry);
Loading history...
35
    }
36
}
37