Issues (590)

src/Configuration.php (2 issues)

1
<?php
2
3
namespace Bdf\Prime;
4
5
use Bdf\Prime\Types\TypesRegistry;
6
use Bdf\Prime\Types\TypesRegistryInterface;
7
use Doctrine\DBAL\Configuration as BaseConfiguration;
8
9
/**
10
 * Configuration
11
 *
12
 * @psalm-suppress InternalClass
13
 */
14
class Configuration extends BaseConfiguration
15
{
16
    /**
17
     * @var TypesRegistryInterface|null
18
     */
19
    private ?TypesRegistryInterface $types;
20
21
    /**
22
     * Set configuration
23
     *
24
     * @param array $options
25
     */
26 439
    public function __construct(array $options = [])
27
    {
28 439
        if (isset($options['logger'])) {
29 1
            $this->setSQLLogger($options['logger']);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Configuration::setSQLLogger() has been deprecated: Use {@see setMiddlewares()} and {@see \Doctrine\DBAL\Logging\Middleware} instead. ( Ignorable by Annotation )

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

29
            /** @scrutinizer ignore-deprecated */ $this->setSQLLogger($options['logger']);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
30
31
            /** @psalm-suppress InternalProperty */
32 1
            unset($options['logger']);
33
        }
34
35 439
        foreach ($options as $name => $value) {
36 1
            $this->$name = $value;
37
        }
38
    }
39
40
    /**
41
     * Set common type registry
42
     *
43
     * @param TypesRegistryInterface $types
44
     * @psalm-assert TypesRegistryInterface $this->types
45
     */
46 421
    public function setTypes(TypesRegistryInterface $types): void
47
    {
48 421
        $this->types = $types;
49
    }
50
51
    /**
52
     * Get common types registry
53
     *
54
     * @return TypesRegistryInterface
55
     */
56 480
    public function getTypes(): TypesRegistryInterface
57
    {
58 480
        if (!isset($this->types)) {
59 420
            $this->setTypes(new TypesRegistry());
60
        }
61
62 480
        return $this->types;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->types could return the type null which is incompatible with the type-hinted return Bdf\Prime\Types\TypesRegistryInterface. Consider adding an additional type-check to rule them out.
Loading history...
63
    }
64
}
65