Skip to content

Commit 5277dff

Browse files
Merge remote-tracking branch 'upstream/7.4' into mailtrap-sandbox7.4
2 parents a499fa9 + 883a1b4 commit 5277dff

File tree

1,122 files changed

+5729
-9085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,122 files changed

+5729
-9085
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@
2828
];
2929

3030
return (new PhpCsFixer\Config())
31-
// @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777
3231
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
3332
->setRules([
34-
'@PHP71Migration' => true,
35-
'@PHPUnit75Migration:risky' => true,
3633
'@Symfony' => true,
3734
'@Symfony:risky' => true,
3835
'phpdoc_var_annotation_correct_order' => true,
@@ -47,6 +44,7 @@
4744
'/s',
4845
]),
4946
],
47+
'php_unit_attributes' => true,
5048
])
5149
->setRiskyAllowed(true)
5250
->setFinder(
@@ -60,25 +58,13 @@
6058
'Symfony/Component/Emoji/Resources/',
6159
'Symfony/Component/Intl/Resources/data/',
6260
])
63-
// explicit tests for ommited @param type, against `no_superfluous_phpdoc_tags`
64-
->notPath('Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php')
65-
->notPath('Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php')
6661
// Support for older PHPunit version
67-
->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php')
6862
->notPath('#Symfony/Bridge/PhpUnit/.*Mock\.php#')
6963
->notPath('#Symfony/Bridge/PhpUnit/.*Legacy#')
70-
// explicit trigger_error tests
71-
->notPath('Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php')
72-
// stop removing spaces on the end of the line in strings
73-
->notPath('Symfony/Component/Messenger/Tests/Command/FailedMessagesShowCommandTest.php')
7464
// disable to not apply `native_function_invocation` rule, as we explicitly break it for testability reason, ref https://github.com/symfony/symfony/pull/59195
7565
->notPath('Symfony/Component/Mailer/Transport/NativeTransportFactory.php')
7666
// auto-generated proxies
77-
->notPath('Symfony/Component/Cache/Traits/RelayProxy.php')
78-
->notPath('Symfony/Component/Cache/Traits/Redis5Proxy.php')
79-
->notPath('Symfony/Component/Cache/Traits/Redis6Proxy.php')
80-
->notPath('Symfony/Component/Cache/Traits/RedisCluster5Proxy.php')
81-
->notPath('Symfony/Component/Cache/Traits/RedisCluster6Proxy.php')
67+
->notPath('#Symfony/Component/Cache/Traits/Re.*Proxy\.php#')
8268
// svg
8369
->notPath('Symfony/Component/ErrorHandler/Resources/assets/images/symfony-ghost.svg.php')
8470
// HTML templates

phpunit

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
66
exit(1);
77
}
88
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
9-
putenv('SYMFONY_PHPUNIT_VERSION=11.5');
9+
if (\PHP_VERSION_ID >= 80300) {
10+
putenv('SYMFONY_PHPUNIT_VERSION=12.1');
11+
} else {
12+
putenv('SYMFONY_PHPUNIT_VERSION=11.5');
13+
}
1014
}
1115
if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
1216
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1');

src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\Persistence\Mapping\ClassMetadata;
1717
use Doctrine\Persistence\ObjectManager;
1818
use Doctrine\Persistence\ObjectRepository;
19+
use PHPUnit\Framework\Attributes\DataProvider;
1920
use PHPUnit\Framework\Attributes\Group;
2021
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
2122
use PHPUnit\Framework\MockObject\MockObject;
@@ -109,9 +110,7 @@ public function testResolveWithStripNulls()
109110
$this->assertSame([], $resolver->resolve($request, $argument));
110111
}
111112

112-
/**
113-
* @dataProvider idsProvider
114-
*/
113+
#[DataProvider('idsProvider')]
115114
public function testResolveWithId(string|int $id)
116115
{
117116
$manager = $this->createMock(ObjectManager::class);
@@ -137,9 +136,7 @@ public function testResolveWithId(string|int $id)
137136
$this->assertSame([$object], $resolver->resolve($request, $argument));
138137
}
139138

140-
/**
141-
* @dataProvider idsProvider
142-
*/
139+
#[DataProvider('idsProvider')]
143140
public function testResolveWithIdAndTypeAlias(string|int $id)
144141
{
145142
$manager = $this->getMockBuilder(ObjectManager::class)->getMock();

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\DBAL\ParameterType;
1616
use Doctrine\DBAL\Platforms\MySQLPlatform;
1717
use Doctrine\Persistence\ManagerRegistry;
18+
use PHPUnit\Framework\Attributes\DataProvider;
1819
use PHPUnit\Framework\TestCase;
1920
use Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector;
2021
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
@@ -148,9 +149,7 @@ public function testReset()
148149
$this->assertEquals([], $c->getQueries());
149150
}
150151

151-
/**
152-
* @dataProvider paramProvider
153-
*/
152+
#[DataProvider('paramProvider')]
154153
public function testCollectQueries($param, $types, $expected)
155154
{
156155
$queries = [
@@ -199,9 +198,7 @@ public function testCollectQueryWithNoParams()
199198
$this->assertTrue($collectedQueries['default'][1]['runnable']);
200199
}
201200

202-
/**
203-
* @dataProvider paramProvider
204-
*/
201+
#[DataProvider('paramProvider')]
205202
public function testSerialization($param, array $types, $expected)
206203
{
207204
$queries = [

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
@@ -145,9 +146,7 @@ public static function getAutomappingData()
145146
];
146147
}
147148

148-
/**
149-
* @dataProvider getAutomappingData
150-
*/
149+
#[DataProvider('getAutomappingData')]
151150
public function testFixManagersAutoMappings(array $originalEm1, array $originalEm2, array $expectedEm1, array $expectedEm2)
152151
{
153152
$emConfigs = [
@@ -187,9 +186,7 @@ public static function providerBasicDrivers(): array
187186
];
188187
}
189188

190-
/**
191-
* @dataProvider providerBasicDrivers
192-
*/
189+
#[DataProvider('providerBasicDrivers')]
193190
public function testLoadBasicCacheDriver(string $class, array $config, array $expectedCalls = [])
194191
{
195192
$container = $this->createContainer();
@@ -270,9 +267,7 @@ public static function providerBundles(): iterable
270267
yield ['NewXmlBundle', 'xml', '/config/doctrine'];
271268
}
272269

273-
/**
274-
* @dataProvider providerBundles
275-
*/
270+
#[DataProvider('providerBundles')]
276271
public function testBundleAutoMapping(string $bundle, string $expectedType, string $dirSuffix)
277272
{
278273
$bundleDir = __DIR__.'/../Fixtures/Bundles/'.$bundle;

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\ORM\AbstractQuery;
1818
use Doctrine\ORM\Query;
1919
use Doctrine\ORM\QueryBuilder;
20+
use PHPUnit\Framework\Attributes\DataProvider;
2021
use PHPUnit\Framework\MockObject\MockObject;
2122
use PHPUnit\Framework\TestCase;
2223
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
@@ -111,9 +112,7 @@ public function testFilterNonIntegerValues()
111112
$loader->getEntitiesByIds('id', [1, '', 2, 3, 'foo', '9223372036854775808']);
112113
}
113114

114-
/**
115-
* @dataProvider provideGuidEntityClasses
116-
*/
115+
#[DataProvider('provideGuidEntityClasses')]
117116
public function testFilterEmptyUuids(string $entityClass)
118117
{
119118
$em = DoctrineTestHelper::createTestEntityManager();
@@ -145,9 +144,7 @@ public function testFilterEmptyUuids(string $entityClass)
145144
$loader->getEntitiesByIds('id', ['71c5fd46-3f16-4abb-bad7-90ac1e654a2d', '', 'b98e8e11-2897-44df-ad24-d2627eb7f499']);
146145
}
147146

148-
/**
149-
* @dataProvider provideUidEntityClasses
150-
*/
147+
#[DataProvider('provideUidEntityClasses')]
151148
public function testFilterUid(string $entityClass)
152149
{
153150
if (Type::hasType('uuid')) {
@@ -188,9 +185,7 @@ public function testFilterUid(string $entityClass)
188185
$loader->getEntitiesByIds('id', ['71c5fd46-3f16-4abb-bad7-90ac1e654a2d', '', 'b98e8e11-2897-44df-ad24-d2627eb7f499']);
189186
}
190187

191-
/**
192-
* @dataProvider provideUidEntityClasses
193-
*/
188+
#[DataProvider('provideUidEntityClasses')]
194189
public function testUidThrowProperException(string $entityClass)
195190
{
196191
if (Type::hasType('uuid')) {

src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\ORM\Mapping\ManyToOneAssociationMapping;
1818
use Doctrine\Persistence\ManagerRegistry;
1919
use Doctrine\Persistence\ObjectManager;
20+
use PHPUnit\Framework\Attributes\DataProvider;
2021
use PHPUnit\Framework\TestCase;
2122
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
2223
use Symfony\Component\Form\Guess\Guess;
@@ -25,9 +26,7 @@
2526

2627
class DoctrineOrmTypeGuesserTest extends TestCase
2728
{
28-
/**
29-
* @dataProvider requiredType
30-
*/
29+
#[DataProvider('requiredType')]
3130
public function testTypeGuesser(string $type, $expected)
3231
{
3332
$classMetadata = $this->createMock(ClassMetadata::class);

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\ORM\EntityManager;
1515
use Doctrine\ORM\Tools\SchemaTool;
1616
use Doctrine\Persistence\ManagerRegistry;
17+
use PHPUnit\Framework\Attributes\Group;
1718
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
1819
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
1920
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
@@ -81,9 +82,8 @@ protected function setUp(): void
8182
/**
8283
* This test case is realistic in collection forms where each
8384
* row contains the same entity field.
84-
*
85-
* @group benchmark
8685
*/
86+
#[Group('benchmark')]
8787
public function testCollapsedEntityField()
8888
{
8989
$this->setMaxRunningTime(1);
@@ -98,9 +98,7 @@ public function testCollapsedEntityField()
9898
}
9999
}
100100

101-
/**
102-
* @group benchmark
103-
*/
101+
#[Group('benchmark')]
104102
public function testCollapsedEntityFieldWithChoices()
105103
{
106104
$choices = $this->em->createQuery('SELECT c FROM '.self::ENTITY_CLASS.' c')->getResult();
@@ -117,9 +115,7 @@ public function testCollapsedEntityFieldWithChoices()
117115
}
118116
}
119117

120-
/**
121-
* @group benchmark
122-
*/
118+
#[Group('benchmark')]
123119
public function testCollapsedEntityFieldWithPreferredChoices()
124120
{
125121
$choices = $this->em->createQuery('SELECT c FROM '.self::ENTITY_CLASS.' c')->getResult();

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\ORM\EntityRepository;
1717
use Doctrine\ORM\Tools\SchemaTool;
1818
use Doctrine\Persistence\ManagerRegistry;
19+
use PHPUnit\Framework\Attributes\DataProvider;
1920
use PHPUnit\Framework\MockObject\MockObject;
2021
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
2122
use Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser;
@@ -119,9 +120,7 @@ public function testInvalidClassOption()
119120
]);
120121
}
121122

122-
/**
123-
* @dataProvider choiceTranslationDomainProvider
124-
*/
123+
#[DataProvider('choiceTranslationDomainProvider')]
125124
public function testChoiceTranslationDomainIsDisabledByDefault($expanded)
126125
{
127126
$entity1 = new SingleIntIdEntity(1, 'Foo');

src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Bridge\Doctrine\Tests;
1313

1414
use Doctrine\Persistence\ObjectManager;
15+
use PHPUnit\Framework\Attributes\DataProvider;
16+
use PHPUnit\Framework\Attributes\RequiresPhp;
1517
use PHPUnit\Framework\TestCase;
1618
use Symfony\Bridge\Doctrine\Tests\Fixtures\DummyManager;
1719
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -49,11 +51,8 @@ public function testResetService()
4951
$this->assertFalse(isset($foo->bar));
5052
}
5153

52-
/**
53-
* @requires PHP 8.4
54-
*
55-
* @dataProvider provideResetServiceWithNativeLazyObjectsCases
56-
*/
54+
#[DataProvider('provideResetServiceWithNativeLazyObjectsCases')]
55+
#[RequiresPhp('8.4')]
5756
public function testResetServiceWithNativeLazyObjects(string $class)
5857
{
5958
$container = new $class();

0 commit comments

Comments
 (0)