8000 replace expectDeprecation() with expectUserDeprecationMessage() · symfony/property-info@200d230 · GitHub
[go: up one dir, main page]

Skip to content

Commit 200d230

Browse files
committed
replace expectDeprecation() with expectUserDeprecationMessage()
1 parent 8178f2e commit 200d230

File tree

5 files changed

+58
-58
lines changed

5 files changed

+58
-58
lines changed

Tests/Extractor/ConstructorExtractorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\PropertyInfo\Tests\Extractor;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
15+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1616
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
1717
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
1818
use Symfony\Component\PropertyInfo\Type as LegacyType;
@@ -23,7 +23,7 @@
2323
*/
2424
class ConstructorExtractorTest extends TestCase
2525
{
26-
use ExpectDeprecationTrait;
26+
use ExpectUserDeprecationMessageTrait;
2727

2828
private ConstructorExtractor $extractor;
2929

@@ -53,7 +53,7 @@ public function testGetTypeIfNoExtractors()
5353
*/
5454
public function testGetTypes()
5555
{
56-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getType()" instead.');
56+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getType()" instead.');
5757

5858
$this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_STRING)], $this->extractor->getTypes('Foo', 'bar', []));
5959
}
@@ -63,7 +63,7 @@ public function testGetTypes()
6363
*/
6464
public function testGetTypesIfNoExtractors()
6565
{
66-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getType()" instead.');
66+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor::getType()" instead.');
6767

6868
$extractor = new ConstructorExtractor([]);
6969
$this->assertNull($extractor->getTypes('Foo', 'bar', []));

Tests/Extractor/PhpDocExtractorTest.php

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

1212
namespace Symfony\Component\PropertyInfo\Tests\Extractor;
1313

14-
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1514
use phpDocumentor\Reflection\DocBlock;
1615
use PHPUnit\Framework\TestCase;
16+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1717
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
1818
use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy;
1919
use Symfony\Component\PropertyInfo\Tests\Fixtures\DockBlockFallback;
@@ -35,7 +35,7 @@
3535
*/
3636
class PhpDocExtractorTest extends TestCase
3737
{
38-
use ExpectDeprecationTrait;
38+
use ExpectUserDeprecationMessageTrait;
3939

4040
private PhpDocExtractor $extractor;
4141

@@ -51,7 +51,7 @@ protected function setUp(): void
5151
*/
5252
public function testExtractLegacy($property, ?array $type, $shortDescription, $longDescription)
5353
{
54-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
54+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
5555

5656
$this->assertEquals($type, $this->extractor->getTypes(Dummy::class, $property));
5757
$this->assertSame($shortDescription, $this->extractor->getShortDescription(Dummy::class, $property));
@@ -76,7 +76,7 @@ public function testGetDocBlock()
7676
*/
7777
public function testParamTagTypeIsOmittedLegacy()
7878
{
79-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
79+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
8080

8181
$this->assertNull($this->extractor->getTypes(OmittedParamTagTypeDocBlock::class, 'omittedType'));
8282
}
@@ -97,7 +97,7 @@ public static function provideLegacyInvalidTypes()
9797
*/
9898
public function testInvalidLegacy($property, $shortDescription, $longDescription)
9999
{
100-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
100+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
101101

102102
$this->assertNull($this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\InvalidDummy', $property));
103103
$this->assertSame($shortDescription, $this->extractor->getShortDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\InvalidDummy', $property));
@@ -109,7 +109,7 @@ public function testInvalidLegacy($property, $shortDescription, $longDescription
109109
*/
110110
public function testEmptyParamAnnotationLegacy()
111111
{
112-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
112+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
113113

114114
$this->assertNull($this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\InvalidDummy', 'foo'));
115115
$this->assertSame('Foo.', $this->extractor->getShortDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\InvalidDummy', 'foo'));
@@ -123,7 +123,7 @@ public function testEmptyParamAnnotationLegacy()
123123
*/
124124
public function testExtractTypesWithNoPrefixesLegacy($property, ?array $type = null)
125125
{
126-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
126+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
127127

128128
$noPrefixExtractor = new PhpDocExtractor(null, [], [], []);
129129

@@ -253,7 +253,7 @@ public static function provideLegacyCollectionTypes()
253253
*/
254254
public function testExtractTypesWithCustomPrefixesLegacy($property, ?array $type = null)
255255
{
256-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
256+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
257257

258258
$customExtractor = new PhpDocExtractor(null, ['add', 'remove'], ['is', 'can']);
259259

@@ -371,7 +371,7 @@ public static function provideLegacyDockBlockFallbackTypes()
371371
*/
372372
public function testDocBlockFallbackLegacy($property, $types)
373373
{
374-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
374+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
375375

376376
$this->assertEquals($types, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\DockBlockFallback', $property));
377377
}
@@ -383,7 +383,7 @@ public function testDocBlockFallbackLegacy($property, $types)
383383
*/
384384
public function testPropertiesDefinedByTraitsLegacy(string $property, LegacyType $type)
385385
{
386-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
386+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
387387

388388
$this->assertEquals([$type], $this->extractor->getTypes(DummyUsingTrait::class, $property));
389389
}
@@ -407,7 +407,7 @@ public static function provideLegacyPropertiesDefinedByTraits(): array
407407
*/
408408
public function testMethodsDefinedByTraitsLegacy(string $property, LegacyType $type)
409409
{
410-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
410+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
411411

412412
$this->assertEquals([$type], $this->extractor->getTypes(DummyUsingTrait::class, $property));
413413
}
@@ -431,7 +431,7 @@ public static function provideLegacyMethodsDefinedByTraits(): array
431431
*/
432432
public function testPropertiesStaticTypeLegacy(string $class, string $property, LegacyType $type)
433433
{
434-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
434+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
435435

436436
$this->assertEquals([$type], $this->extractor->getTypes($class, $property));
437437
}
@@ -451,7 +451,7 @@ public static function provideLegacyPropertiesStaticType(): array
451451
*/
452452
public function testPropertiesParentTypeLegacy(string $class, string $property, ?array $types)
453453
{
454-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
454+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
455455

456456
$this->assertEquals($types, $this->extractor->getTypes($class, $property));
457457
}
@@ -469,7 +469,7 @@ public static function provideLegacyPropertiesParentType(): array
469469
*/
470470
public function testUnknownPseudoTypeLegacy()
471471
{
472-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
472+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
473473

474474
$this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'scalar')], $this->extractor->getTypes(PseudoTypeDummy::class, 'unknownPseudoType'));
475475
}
@@ -479,7 +479,7 @@ public function testUnknownPseudoTypeLegacy()
479479
*/
480480
public function testGenericInterface()
481481
{
482-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
482+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
483483

484484
$this->assertNull($this->extractor->getTypes(Dummy::class, 'genericInterface'));
485485
}
@@ -491,7 +491,7 @@ public function testGenericInterface()
491491
*/
492492
public function testExtractConstructorTypesLegacy($property, ?array $type = null)
493493
{
494-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypesFromConstructor()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypeFromConstructor()" instead.');
494+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypesFromConstructor()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypeFromConstructor()" instead.');
495495

496496
$this->assertEquals($type, $this->extractor->getTypesFromConstructor('Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy', $property));
497497
}
@@ -515,7 +515,7 @@ public static function provideLegacyConstructorTypes()
515515
*/
516516
public function testPseudoTypesLegacy($property, array $type)
517517
{
518-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
518+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
519519

520520
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\PseudoTypesDummy', $property));
521521
}
@@ -542,7 +542,7 @@ public static function provideLegacyPseudoTypes(): array
542542
*/
543543
public function testExtractPromotedPropertyLegacy(string $property, ?array $types)
544544
{
545-
$this->expectDeprecation('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
545+
$this->expectUserDeprecationMessage('Since symfony/property-info 7.3: The "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getTypes()" method is deprecated, use "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor::getType()" instead.');
546546

547547
$this->assertEquals($types, $this->extractor->getTypes(Php80Dummy::class, $property));
548548
}

0 commit comments

Comments
 (0)
0