Make static analysis more strict, Psalm level 5, PhpStan level 5
Showing 5 of 10 files from the diff.
src/Yuml/MetadataGrapher.php
changed.
src/Options/DBALConnection.php
changed.
Other files ignored by Codecov
tests/Assets/Entity/EntityWithoutRepository.php
has changed.
phpstan.neon
has changed.
tests/Framework/TestCase.php
has changed.
tests/Assets/Entity/TargetEntity.php
has changed.
psalm.xml
has changed.
@@ -88,7 +88,7 @@
Loading
88 | 88 | if ($class2 === null) { |
|
89 | 89 | return $this->getClassString($class1) |
|
90 | 90 | . ($isInverse ? '<' : '<>') . '-' . $association . ' ' |
|
91 | - | . ($class1Count > 1 ? '*' : ($class1Count ? '1' : '')) |
|
91 | + | . ($class1Count > 1 ? '*' : '1') |
|
92 | 92 | . ($isInverse ? '<>' : '>') |
|
93 | 93 | . '[' . str_replace('\\', '.', $targetClassName) . ']'; |
|
94 | 94 | } |
@@ -116,7 +116,7 @@
Loading
116 | 116 | . ($class2Count > 1 ? '*' : ($class2Count ? '1' : '')) // class2 side single/multi valued |
|
117 | 117 | . '-' |
|
118 | 118 | . $class1SideName . ' ' |
|
119 | - | . ($class1Count > 1 ? '*' : ($class1Count ? '1' : '')) // class1 side single/multi valued |
|
119 | + | . ($class1Count > 1 ? '*' : '1') // class1 side single/multi valued |
|
120 | 120 | . ($bidirectional && $isInverse ? '<>' : '>') // class1 side arrow |
|
121 | 121 | . $this->getClassString($class2); |
|
122 | 122 | } |
@@ -11,6 +11,7 @@
Loading
11 | 11 | use DoctrineORMModule\Options\DBALConnection; |
|
12 | 12 | use Interop\Container\ContainerInterface; |
|
13 | 13 | use Laminas\ServiceManager\ServiceLocatorInterface; |
|
14 | + | use PDO; |
|
14 | 15 | ||
15 | 16 | use function array_key_exists; |
|
16 | 17 | use function array_merge; |
@@ -35,6 +36,7 @@
Loading
35 | 36 | ||
36 | 37 | if (is_string($pdo)) { |
|
37 | 38 | $pdo = $serviceLocator->get($pdo); |
|
39 | + | assert($pdo instanceof PDO); |
|
38 | 40 | } |
|
39 | 41 | ||
40 | 42 | $params = [ |
@@ -55,6 +57,7 @@
Loading
55 | 57 | $configuration = $serviceLocator->get($options->getConfiguration()); |
|
56 | 58 | $eventManager = $serviceLocator->get($options->getEventManager()); |
|
57 | 59 | ||
60 | + | /** @psalm-suppress InvalidArgument */ |
|
58 | 61 | $connection = DriverManager::getConnection($params, $configuration, $eventManager); |
|
59 | 62 | foreach ($options->getDoctrineTypeMappings() as $dbType => $doctrineType) { |
|
60 | 63 | $connection->getDatabasePlatform()->registerDoctrineTypeMapping($dbType, $doctrineType); |
@@ -4,8 +4,6 @@
Loading
4 | 4 | ||
5 | 5 | namespace DoctrineORMModule\Service; |
|
6 | 6 | ||
7 | - | use Doctrine\Common\EventSubscriber; |
|
8 | - | use Doctrine\ORM\Events; |
|
9 | 7 | use Doctrine\ORM\Tools\ResolveTargetEntityListener; |
|
10 | 8 | use DoctrineModule\Service\AbstractFactory; |
|
11 | 9 | use DoctrineORMModule\Options\EntityResolver; |
@@ -33,12 +31,7 @@
Loading
33 | 31 | $targetEntityListener->addResolveTargetEntity($oldEntity, $newEntity, []); |
|
34 | 32 | } |
|
35 | 33 | ||
36 | - | // Starting from Doctrine ORM 2.5, the listener implements EventSubscriber |
|
37 | - | if ($targetEntityListener instanceof EventSubscriber) { |
|
38 | - | $eventManager->addEventSubscriber($targetEntityListener); |
|
39 | - | } else { |
|
40 | - | $eventManager->addEventListener(Events::loadClassMetadata, $targetEntityListener); |
|
41 | - | } |
|
34 | + | $eventManager->addEventSubscriber($targetEntityListener); |
|
42 | 35 | ||
43 | 36 | return $eventManager; |
|
44 | 37 | } |
@@ -4,7 +4,9 @@
Loading
4 | 4 | ||
5 | 5 | namespace DoctrineORMModule\Options; |
|
6 | 6 | ||
7 | - | use Doctrine\DBAL\Driver\PDO\MySQL\Driver; |
|
7 | + | use Doctrine\DBAL\Connection; |
|
8 | + | use Doctrine\DBAL\Driver; |
|
9 | + | use Doctrine\DBAL\Driver\PDO\MySQL\Driver as PDOMySQLDriver; |
|
8 | 10 | use Laminas\Stdlib\AbstractOptions; |
|
9 | 11 | use PDO; |
|
10 | 12 |
@@ -45,7 +47,7 @@
Loading
45 | 47 | * |
|
46 | 48 | * @var string |
|
47 | 49 | */ |
|
48 | - | protected $driverClass = Driver::class; |
|
50 | + | protected $driverClass = PDOMySQLDriver::class; |
|
49 | 51 | ||
50 | 52 | /** |
|
51 | 53 | * Set the wrapper class for the driver. In general, this should not |
@@ -146,6 +148,9 @@
Loading
146 | 148 | $this->driverClass = $driverClass; |
|
147 | 149 | } |
|
148 | 150 | ||
151 | + | /** |
|
152 | + | * @return class-string<Driver>|null |
|
153 | + | */ |
|
149 | 154 | public function getDriverClass(): ?string |
|
150 | 155 | { |
|
151 | 156 | return $this->driverClass; |
@@ -172,6 +177,9 @@
Loading
172 | 177 | $this->wrapperClass = $wrapperClass; |
|
173 | 178 | } |
|
174 | 179 | ||
180 | + | /** |
|
181 | + | * @return class-string<Connection>|null |
|
182 | + | */ |
|
175 | 183 | public function getWrapperClass(): ?string |
|
176 | 184 | { |
|
177 | 185 | return $this->wrapperClass; |
@@ -23,7 +23,7 @@
Loading
23 | 23 | public function createService(ServiceLocatorInterface $serviceLocator): YumlController |
|
24 | 24 | { |
|
25 | 25 | if ($serviceLocator instanceof AbstractPluginManager) { |
|
26 | - | $serviceLocator = $serviceLocator->getServiceLocator() ?: $serviceLocator; |
|
26 | + | $serviceLocator = $serviceLocator->getServiceLocator(); |
|
27 | 27 | } |
|
28 | 28 | ||
29 | 29 | return $this($serviceLocator, YumlController::class); |
Files | Coverage |
---|---|
src | 84.06% |
Project Totals (32 files) | 84.06% |
1452044589
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.