Skip to content

Commit c790de1

Browse files
Merge branch '4.3' into 4.4
* 4.3: [DI] Dont cache classes with missing parents [HttpClient] Fix a crash when calling CurlHttpClient::__destruct() [Validator] Add the missing translations for the Hebrew (\"he\") locale and fix 2 typos [FrameworkBundle][Translation] Invalidate cached catalogues when the scanned directories change
2 parents 13cda60 + b9cec89 commit c790de1

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

ContainerBuilder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function getReflectionClass(?string $class, bool $throw = true): ?\Reflec
343343
return null;
344344
}
345345

346-
$resource = null;
346+
$resource = $classReflector = null;
347347

348348
try {
349349
if (isset($this->classReflectors[$class])) {
@@ -358,7 +358,6 @@ public function getReflectionClass(?string $class, bool $throw = true): ?\Reflec
358358
if ($throw) {
359359
throw $e;
360360
}
361-
$classReflector = false;
362361
}
363362

364363
if ($this->trackResources) {

Loader/FileLoader.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,7 @@ private function findClasses(string $namespace, string $pattern, array $excludeP
156156
try {
157157
$r = $this->container->getReflectionClass($class);
158158
} catch (\ReflectionException $e) {
159-
$classes[$class] = sprintf(
160-
'While discovering services from namespace "%s", an error was thrown when processing the class "%s": "%s".',
161-
$namespace,
162-
$class,
163-
$e->getMessage()
164-
);
159+
$classes[$class] = $e->getMessage();
165160
continue;
166161
}
167162
// check to make sure the expected class exists

Tests/Compiler/AutowirePassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public function testParentClassNotFoundThrowsException()
363363
$pass->process($container);
364364
$this->fail('AutowirePass should have thrown an exception');
365365
} catch (AutowiringFailedException $e) {
366-
$this->assertSame('Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).', (string) $e->getMessage());
366+
$this->assertRegExp('{^Cannot autowire service "a": argument "\$r" of method "(Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Compiler\\\\)BadParentTypeHintedArgument::__construct\(\)" has type "\1OptionalServiceClass" but this class is missing a parent class \(Class "?Symfony\\\\Bug\\\\NotExistClass"? not found}', (string) $e->getMessage());
367367
}
368368
}
369369

Tests/Loader/FileLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ public function testMissingParentClass()
196196

197197
$this->assertTrue($container->has(MissingParent::class));
198198

199-
$this->assertSame(
200-
['While discovering services from namespace "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\", an error was thrown when processing the class "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent": "Class Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingClass not found".'],
201-
$container->getDefinition(MissingParent::class)->getErrors()
199+
$this->assertRegExp(
200+
'{Class "?Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\BadClasses\\\\MissingClass"? not found}',
201+
$container->getDefinition(MissingParent::class)->getErrors()[0]
202202
);
203203
}
204204

0 commit comments

Comments
 (0)