Skip to content

Commit b9cec89

Browse files
Merge branch '3.4' into 4.3
* 3.4: [DI] Dont cache classes with missing parents [Validator] Add the missing translations for the Hebrew (\"he\") locale and fix 2 typos
2 parents 781d6d8 + e32d6bd commit b9cec89

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
@@ -149,12 +149,7 @@ private function findClasses($namespace, $pattern, array $excludePatterns)
149149
try {
150150
$r = $this->container->getReflectionClass($class);
151151
} catch (\ReflectionException $e) {
152-
$classes[$class] = sprintf(
153-
'While discovering services from namespace "%s", an error was thrown when processing the class "%s": "%s".',
154-
$namespace,
155-
$class,
156-
$e->getMessage()
157-
);
152+
$classes[$class] = $e->getMessage();
158153
continue;
159154
}
160155
// 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)