Skip to content

Commit d51096e

Browse files
Merge branch '4.4' into 5.0
* 4.4: (28 commits) bug #34554 [HttpClient] Fix early cleanup of pushed HTTP/2 responses (lyrixx) Fix tests [Console] Fix commands description with numeric namespaces [HttpFoundation] Fixed typo [DI] Skip unknown method calls for factories in check types pass [EventDispatcher] Better error reporting when arguments to dispatch() are swapped improve upgrade instructions for twig.exception_controller configuration [HttpFoundation] Update CHANGELOG for PdoSessionHandler BC BREAK in 4.4 [Serializer] CsvEncoder::NO_HEADERS_KEY ignored when used in constructor [Form] Keep preferred_choices order for choice groups [Debug] work around failing chdir() on Darwin [PhpUnitBridge] Read configuration CLI directive [DI] Missing test on YamlFileLoader Revert "minor #34608 [Process] add tests for php executable finder if file does not exist (ahmedash95)" Simpler example for Apache basic auth workaround [Console] Fix trying to access array offset on value of type int [Config] Remove extra sprintf arg [HttpKernel] fix typo [HttpKernel] Support typehint to deprecated FlattenException in controller Add preview mode support for Html and Serializer error renderers ...
2 parents dfbb4d1 + afd7f3b commit d51096e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1818
use Symfony\Component\DependencyInjection\Exception\InvalidParameterTypeException;
19+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1920
use Symfony\Component\DependencyInjection\Parameter;
2021
use Symfony\Component\DependencyInjection\Reference;
2122
use Symfony\Component\DependencyInjection\ServiceLocator;
@@ -37,24 +38,22 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
3738
private const SCALAR_TYPES = ['int', 'float', 'bool', 'string'];
3839

3940
private $autoload;
40-
private $ignoredServices;
4141

4242
/**
4343
* @param bool $autoload Whether services who's class in not loaded should be checked or not.
4444
* Defaults to false to save loading code during compilation.
4545
*/
46-
public function __construct(bool $autoload = false, array $ignoredServices = [])
46+
public function __construct(bool $autoload = false)
4747
{
4848
$this->autoload = $autoload;
49-
$this->ignoredServices = array_flip($ignoredServices);
5049
}
5150

5251
/**
5352
* {@inheritdoc}
5453
*/
5554
protected function processValue($value, $isRoot = false)
5655
{
57-
if (!$value instanceof Definition || isset($this->ignoredServices[$this->currentId])) {
56+
if (!$value instanceof Definition || $value->hasErrors()) {
5857
return parent::processValue($value, $isRoot);
5958
}
6059

@@ -71,7 +70,15 @@ protected function processValue($value, $isRoot = false)
7170
}
7271

7372
foreach ($value->getMethodCalls() as $methodCall) {
74-
$reflectionMethod = $this->getReflectionMethod($value, $methodCall[0]);
73+
try {
74+
$reflectionMethod = $this->getReflectionMethod($value, $methodCall[0]);
75+
} catch (RuntimeException $e) {
76+
if ($value->getFactory()) {
77+
continue;
78+
}
79+
80+
throw $e;
81+
}
7582

7683
$this->checkTypeDeclarations($value, $reflectionMethod, $methodCall[1]);
7784
}

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ public function testParsesIteratorArgument()
374374
$lazyDefinition = $container->getDefinition('lazy_context');
375375

376376
$this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments');
377+
378+
$message = 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.';
379+
$this->assertSame($message, $container->getDefinition('deprecated_service')->getDeprecationMessage('deprecated_service'));
377380
}
378381

379382
public function testAutowire()

0 commit comments

Comments
 (0)