Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function processValue($value, $isRoot = false)
return $value;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Deprecated;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Foo;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\FooObject;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\UnionConstructor;
Expand Down Expand Up @@ -723,6 +724,19 @@ public function testProcessSkipSkippedIds()
$this->addToAssertionCount(1);
}

public function testProcessSkipsDeprecatedDefinitions()
{
$container = new ContainerBuilder();
$container
->register('foobar', Deprecated::class)
->setDeprecated(true)
;

(new CheckTypeDeclarationsPass(true))->process($container);

$this->addToAssertionCount(1);
}

public function testProcessHandleClosureForCallable()
{
$closureDefinition = new Definition(\Closure::class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;

trigger_deprecation('foo/bar', '1.2.3', 'Deprecated class.');

class Deprecated
{
}