Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 531c81a

Browse filesBrowse files
committed
[DI] Skip deprecated definitions in CheckTypeDeclarationsPass
1 parent 8076c2f commit 531c81a
Copy full SHA for 531c81a

File tree

Expand file treeCollapse file tree

3 files changed

+24
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+24
-1
lines changed

‎src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php
+1-1Lines 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

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php
+14Lines 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;
@@ -723,6 +724,19 @@ public function testProcessSkipSkippedIds()
723724
$this->addToAssertionCount(1);
724725
}
725726

727+
public function testProcessSkipsDeprecatedDefinitions()
728+
{
729+
$container = new ContainerBuilder();
730+
$container
731+
->register('foobar', Deprecated::class)
732+
->setDeprecated(true)
733+
;
734+
735+
(new CheckTypeDeclarationsPass(true))->process($container);
736+
737+
$this->addToAssertionCount(1);
738+
}
739+
726740
public function testProcessHandleClosureForCallable()
727741
{
728742
$closureDefinition = new Definition(\Closure::class);
+9Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.