Merge remote-tracking branch 'origin/3.4.x' into 4.1.x

This commit is contained in:
Grégoire Paris
2025-11-02 00:41:24 +01:00
85 changed files with 55 additions and 69 deletions

View File

@@ -35,12 +35,12 @@
},
"autoload": {
"psr-4": {
"Doctrine\\Persistence\\": "src/Persistence"
"Doctrine\\Persistence\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\": "tests"
"Doctrine\\Tests\\Persistence\\": "tests"
}
},
"config": {

View File

@@ -30,11 +30,11 @@
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming">
<exclude-pattern>src/Persistence/AbstractManagerRegistry.php</exclude-pattern>
<exclude-pattern>src/Persistence/Mapping/AbstractClassMetadataFactory.php</exclude-pattern>
<exclude-pattern>src/AbstractManagerRegistry.php</exclude-pattern>
<exclude-pattern>src/Mapping/AbstractClassMetadataFactory.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix">
<exclude-pattern>src/Persistence/Mapping/MappingException.php</exclude-pattern>
<exclude-pattern>src/Mapping/MappingException.php</exclude-pattern>
</rule>
</ruleset>

View File

@@ -4,118 +4,118 @@ parameters:
message: '#^Call to an undefined static method T of object\:\:loadMetadata\(\)\.$#'
identifier: staticMethod.notFound
count: 1
path: src/Persistence/Mapping/Driver/StaticPHPDriver.php
path: src/Mapping/Driver/StaticPHPDriver.php
-
message: '#^Template type TObjectManager is declared as covariant, but occurs in invariant position in property Doctrine\\Persistence\\ObjectManagerDecorator\:\:\$wrapped\.$#'
identifier: generics.variance
count: 1
path: src/Persistence/ObjectManagerDecorator.php
path: src/ObjectManagerDecorator.php
-
message: '#^Method Doctrine\\Persistence\\Reflection\\EnumReflectionProperty\:\:toEnum\(\) should return array\<BackedEnum\>\|BackedEnum but returns array\<BackedEnum\|int\|string\>\.$#'
identifier: return.type
count: 1
path: src/Persistence/Reflection/EnumReflectionProperty.php
path: src/Reflection/EnumReflectionProperty.php
-
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(BackedEnum\|int\|string\)\: mixed\)\|null, array\{class\-string\<BackedEnum\>, ''from''\} given\.$#'
identifier: argument.type
count: 1
path: src/Persistence/Reflection/EnumReflectionProperty.php
path: src/Reflection/EnumReflectionProperty.php
-
message: '#^PHPDoc tag @var with type Doctrine\\Persistence\\Mapping\\ClassMetadata\<object\> is not subtype of native type PHPUnit\\Framework\\MockObject\\MockObject\.$#'
identifier: varTag.nativeType
count: 1
path: tests/Persistence/Mapping/ClassMetadataFactoryTest.php
path: tests/Mapping/ClassMetadataFactoryTest.php
-
message: '#^Parameter \#1 \$directories of static method Doctrine\\Persistence\\Mapping\\Driver\\FileClassLocator\:\:createFromDirectories\(\) expects list\<string\>, non\-empty\-array\<int, string\> given\.$#'
identifier: argument.type
count: 1
path: tests/Persistence/Mapping/ColocatedMappingDriverTest.php
path: tests/Mapping/ColocatedMappingDriverTest.php
-
message: '#^Parameter \#2 \$excludedDirectories of static method Doctrine\\Persistence\\Mapping\\Driver\\FileClassLocator\:\:createFromDirectories\(\) expects list\<string\>, array\<int, string\> given\.$#'
identifier: argument.type
count: 1
path: tests/Persistence/Mapping/ColocatedMappingDriverTest.php
path: tests/Mapping/ColocatedMappingDriverTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''Doctrine\\\\Tests…'', ''Doctrine\\\\Tests\\\\ORM…'', ''Doctrine\\\\Tests\\\\ORM…''\} and list\<class\-string\> will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: tests/Persistence/Mapping/DriverChainTest.php
path: tests/Mapping/DriverChainTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''Doctrine\\\\Tests…'', ''Other\\\\Class''\} and list\<class\-string\> will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: tests/Persistence/Mapping/DriverChainTest.php
path: tests/Mapping/DriverChainTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Doctrine\\\\Persistence\\\\Reflection\\\\RuntimeReflectionProperty'' and Doctrine\\Persistence\\Reflection\\RuntimeReflectionProperty will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 3
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''ReflectionProperty'' and Doctrine\\Persistence\\Reflection\\RuntimeReflectionProperty will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 5
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Property Doctrine\\Tests\\Persistence\\Mapping\\RuntimeReflectionServiceTest\:\:\$nonTypedDefaultProperty is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Property Doctrine\\Tests\\Persistence\\Mapping\\RuntimeReflectionServiceTest\:\:\$nonTypedNoDefaultProperty is unused\.$#'
identifier: property.unused
count: 1
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Property Doctrine\\Tests\\Persistence\\Mapping\\RuntimeReflectionServiceTest\:\:\$typedDefaultProperty is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Property Doctrine\\Tests\\Persistence\\Mapping\\RuntimeReflectionServiceTest\:\:\$typedNoDefaultProperty is unused\.$#'
identifier: property.unused
count: 1
path: tests/Persistence/Mapping/RuntimeReflectionServiceTest.php
path: tests/Mapping/RuntimeReflectionServiceTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''Foo\\\\stdClass'', ''Foo\\\\sub\\\\subClass'', ''Foo\\\\sub\\\\subsub…''\} and list\<class\-string\> will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: tests/Persistence/Mapping/SymfonyFileLocatorTest.php
path: tests/Mapping/SymfonyFileLocatorTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with non\-empty\-list\<''Foo\\\\Bar\\\\subDirClass''\|''Foo\\\\global''\|''Foo\\\\stdClass''\> and list\<class\-string\> will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: tests/Persistence/Mapping/SymfonyFileLocatorTest.php
path: tests/Mapping/SymfonyFileLocatorTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with non\-empty\-list\<''Foo\\\\Bar\\\\subDirClass''\|''Foo\\\\stdClass''\> and list\<class\-string\> will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: tests/Persistence/Mapping/SymfonyFileLocatorTest.php
path: tests/Mapping/SymfonyFileLocatorTest.php
-
message: '#^Property Doctrine\\Tests\\Persistence\\Reflection\\TypedFoo\:\:\$id is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/Persistence/Reflection/TypedNoDefaultReflectionPropertyTest.php
path: tests/Reflection/TypedNoDefaultReflectionPropertyTest.php
-
message: '#^Method Doctrine\\Tests\\Persistence\\RuntimeReflectionPropertyTestProxyMock\:\:__setInitialized\(\) has parameter \$initialized with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/Persistence/RuntimeReflectionPropertyTest.php
path: tests/RuntimeReflectionPropertyTest.php

View File

@@ -11,26 +11,26 @@ parameters:
paths:
- src
- tests
- tests/Persistence/Mapping/_files/colocated/Foo.mphp
- tests/Mapping/_files/colocated/Foo.mphp
excludePaths:
- tests/Persistence/Mapping/_files/Doctrine.Tests.Persistence.Mapping.PHPTestEntity.php
- tests/Mapping/_files/Doctrine.Tests.Persistence.Mapping.PHPTestEntity.php
ignoreErrors:
- '#Variable property access on \$this\(Doctrine\\Persistence\\Reflection\\TypedNoDefaultReflectionProperty\)\.#'
-
message: '#Parameter \#1 \$class of method Doctrine\\Persistence\\Mapping\\RuntimeReflectionService\:\:getParentClasses\(\) expects class\-string, string given\.#'
path: 'tests/Persistence/Mapping/RuntimeReflectionServiceTest.php'
path: 'tests/Mapping/RuntimeReflectionServiceTest.php'
# https://github.com/phpstan/phpstan/issues/5009
-
message: '#Call to function assert\(\) with true will always evaluate to true\.#'
path: 'src/Persistence/Reflection/TypedNoDefaultReflectionProperty.php'
path: 'src/Reflection/TypedNoDefaultReflectionProperty.php'
-
message: '#Instanceof between Closure and Closure will always evaluate to true\.#'
path: 'src/Persistence/Reflection/TypedNoDefaultReflectionProperty.php'
path: 'src/Reflection/TypedNoDefaultReflectionProperty.php'
-
message: '#Class Foo not found#'
path: 'tests/Persistence/Mapping/ClassMetadataFactoryTest.php'
path: 'tests/Mapping/ClassMetadataFactoryTest.php'

View File

@@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests;
use PHPUnit\Framework\TestCase;
/**
* Base testcase class for all Doctrine testcases.
*/
abstract class DoctrineTestCase extends TestCase
{
}

View File

@@ -6,11 +6,11 @@ namespace Doctrine\Tests\Persistence\Event;
use Doctrine\Persistence\Event\PreUpdateEventArgs;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\TestObject;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
class PreUpdateEventArgsTest extends DoctrineTestCase
class PreUpdateEventArgsTest extends TestCase
{
public function testPreUpdateEventArgs(): void
{

View File

@@ -11,16 +11,16 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectRepository;
use Doctrine\Persistence\Proxy;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\Mapping\TestClassMetadataFactory;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use function assert;
use function call_user_func;
#[Group('DCOM-270')]
class ManagerRegistryTest extends DoctrineTestCase
class ManagerRegistryTest extends TestCase
{
private TestManagerRegistry $mr;

View File

@@ -9,10 +9,10 @@ use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ReflectionService;
use Doctrine\Tests\DoctrineTestCase;
use PHPUnit\Framework\TestCase;
use RuntimeException;
final class AbstractClassMetadataFactoryTest extends DoctrineTestCase
final class AbstractClassMetadataFactoryTest extends TestCase
{
/** @param ClassMetadata<object>|null $metadata */
private function createTestFactory(

View File

@@ -8,10 +8,10 @@ use Doctrine\Persistence\Mapping\AbstractClassMetadataFactory;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Tests\DoctrineTestCase;
use Foo;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use ReflectionMethod;
@@ -19,7 +19,7 @@ use stdClass;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
#[CoversClass(AbstractClassMetadataFactory::class)]
class ClassMetadataFactoryTest extends DoctrineTestCase
class ClassMetadataFactoryTest extends TestCase
{
/** @phpstan-var TestClassMetadataFactory<ClassMetadata<object>> */
private TestClassMetadataFactory $cmf;

View File

@@ -6,13 +6,13 @@ namespace Doctrine\Tests\Persistence\Mapping;
use Doctrine\Persistence\Mapping\Driver\DefaultFileLocator;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Tests\DoctrineTestCase;
use PHPUnit\Framework\TestCase;
use function sort;
use const DIRECTORY_SEPARATOR;
class DefaultFileLocatorTest extends DoctrineTestCase
class DefaultFileLocatorTest extends TestCase
{
public function testGetPaths(): void
{

View File

@@ -5,11 +5,11 @@ declare(strict_types=1);
namespace Doctrine\Tests\Persistence\Mapping\Driver;
use Doctrine\Persistence\Mapping\Driver\ClassNames;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\Entity;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\EntityFixture;
use PHPUnit\Framework\TestCase;
class ClassNamesTest extends DoctrineTestCase
class ClassNamesTest extends TestCase
{
public function testGetClassNames(): void
{

View File

@@ -7,13 +7,13 @@ namespace Doctrine\Tests\Persistence\Mapping\Driver;
use DirectoryIterator;
use Doctrine\Persistence\Mapping\Driver\FileClassLocator;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\Entity;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\EntityFixture;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\Foo;
use Doctrine\Tests\Persistence\Mapping\_files\colocated\TestClass;
use EmptyIterator;
use Phar;
use PHPUnit\Framework\TestCase;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
@@ -24,7 +24,7 @@ use function unlink;
use const SORT_STRING;
final class FileClassLocatorTest extends DoctrineTestCase
final class FileClassLocatorTest extends TestCase
{
public function testGetClassNames(): void
{

View File

@@ -8,14 +8,14 @@ use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\Mapping\Fixtures\Manager\Manager;
use Doctrine\Tests\Persistence\Mapping\Fixtures\Model;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use stdClass;
class DriverChainTest extends DoctrineTestCase
class DriverChainTest extends TestCase
{
#[TestWith(['Doctrine\Tests\Models\Company', 'Doctrine\Tests\Persistence\Mapping'])]
#[TestWith(['Doctrine\Tests\Persistence\Map\\', 'Doctrine\Tests\Persistence\Map'])]

View File

@@ -7,17 +7,17 @@ namespace Doctrine\Tests\Persistence\Mapping;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
use Doctrine\Persistence\Mapping\Driver\FileLocator;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Tests\Persistence\Mapping\Fixtures\AnotherGlobalClass;
use Doctrine\Tests\Persistence\Mapping\Fixtures\GlobalClass;
use Doctrine\Tests\Persistence\Mapping\Fixtures\NotLoadedClass;
use Doctrine\Tests\Persistence\Mapping\Fixtures\TestClassMetadata;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use stdClass;
use function str_contains;
class FileDriverTest extends DoctrineTestCase
class FileDriverTest extends TestCase
{
public function testGlobalBasename(): void
{

View File

@@ -6,9 +6,9 @@ namespace Doctrine\Tests\Persistence\Mapping;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\PHPDriver;
use Doctrine\Tests\DoctrineTestCase;
use PHPUnit\Framework\TestCase;
class PHPDriverTest extends DoctrineTestCase
class PHPDriverTest extends TestCase
{
public function testLoadMetadata(): void
{

View File

@@ -6,9 +6,9 @@ namespace Doctrine\Tests\Persistence\Mapping;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
use Doctrine\Tests\DoctrineTestCase;
use PHPUnit\Framework\TestCase;
class StaticPHPDriverTest extends DoctrineTestCase
class StaticPHPDriverTest extends TestCase
{
public function testLoadMetadata(): void
{

View File

@@ -6,16 +6,16 @@ namespace Doctrine\Tests\Persistence\Mapping;
use Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Tests\DoctrineTestCase;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function realpath;
use function sort;
use const DIRECTORY_SEPARATOR;
class SymfonyFileLocatorTest extends DoctrineTestCase
class SymfonyFileLocatorTest extends TestCase
{
public function testGetPaths(): void
{