Skip to content

Commit a349c2f

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: [Security] Replace message data in JSON security error response [DI] Skip deprecated definitions in CheckTypeDeclarationsPass [Messenger][AmazonSqs] Fix auto-setup for fifo queue [DoctrineBridge] Take into account that indexBy="person_id" could be a db column name, for a referenced entity
2 parents e17a8a3 + 0a071ef commit a349c2f

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function processValue($value, $isRoot = false)
8484
return $value;
8585
}
8686

87-
if (!$value instanceof Definition || $value->hasErrors()) {
87+
if (!$value instanceof Definition || $value->hasErrors() || $value->isDeprecated()) {
8888
return parent::processValue($value, $isRoot);
8989
}
9090

Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
2525
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2626
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
27+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Deprecated;
2728
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Foo;
2829
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\FooObject;
2930
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\UnionConstructor;
@@ -720,6 +721,19 @@ public function testProcessSkipSkippedIds()
720721
$this->addToAssertionCount(1);
721722
}
722723

724+
public function testProcessSkipsDeprecatedDefinitions()
725+
{
726+
$container = new ContainerBuilder();
727+
$container
728+
->register('foobar', Deprecated::class)
729+
->setDeprecated(true)
730+
;
731+
732+
(new CheckTypeDeclarationsPass(true))->process($container);
733+
734+
$this->addToAssertionCount(1);
735+
}
736+
723737
public function testProcessHandleClosureForCallable()
724738
{
725739
$closureDefinition = new Definition(\Closure::class);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
4+
5+
trigger_deprecation('foo/bar', '1.2.3', 'Deprecated class.');
6+
7+
class Deprecated
8+
{
9+
}

0 commit comments

Comments
 (0)