Skip to content

Commit 48bee72

Browse files
committedJun 5, 2023
Reject non instances of ORM\ClassMetadata
1 parent c00fd7d commit 48bee72

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
 

‎lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
use Doctrine\DBAL\Schema\Table;
1111
use Doctrine\DBAL\Types\Type;
1212
use Doctrine\DBAL\Types\Types;
13-
use Doctrine\Deprecations\Deprecation;
1413
use Doctrine\Inflector\Inflector;
1514
use Doctrine\Inflector\InflectorFactory;
1615
use Doctrine\ORM\Mapping\ClassMetadata;
1716
use Doctrine\ORM\Mapping\MappingException;
1817
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
1918
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
2019
use InvalidArgumentException;
20+
use TypeError;
2121

2222
use function array_diff;
2323
use function array_keys;
@@ -28,6 +28,7 @@
2828
use function in_array;
2929
use function preg_replace;
3030
use function sort;
31+
use function sprintf;
3132
use function strtolower;
3233

3334
/**
@@ -157,14 +158,12 @@ public function setInflector(Inflector $inflector): void
157158
public function loadMetadataForClass(string $className, PersistenceClassMetadata $metadata): void
158159
{
159160
if (! $metadata instanceof ClassMetadata) {
160-
Deprecation::trigger(
161-
'doctrine/orm',
162-
'https://github.com/doctrine/orm/pull/249',
163-
'Passing an instance of %s to %s is deprecated, please pass a %s instance instead.',
164-
$metadata::class,
161+
throw new TypeError(sprintf(
162+
'Argument #2 passed to %s() must be an instance of %s, %s given.',
165163
__METHOD__,
166164
ClassMetadata::class,
167-
);
165+
$metadata::class,
166+
));
168167
}
169168

170169
$this->reverseEngineerMappingFromDatabase();

0 commit comments

Comments
 (0)