Skip to content

Commit a69c60d

Browse files
committed
fixes
1 parent 87c39fb commit a69c60d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,17 @@ public function loadClass($class)
192192
}
193193
}
194194

195+
$parentAndTraits = class_uses($name, false);
195196
if ($parent = get_parent_class($class)) {
197+
$parentAndTraits[] = $parent;
198+
196199
if (isset(self::$final[$parent])) {
197200
@trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED);
198201
}
199202
}
200203

201-
$parentAndTraits = ($parent ? array($parent => $parent) : array()) + class_uses($name, false);
202-
203204
// Detect if the parent is annotated
204-
foreach ($parentAndTraits + $this->getOwnInterfaces($name) as $use) {
205+
foreach ($parentAndTraits + $this->getOwnInterfaces($name, $parent) as $use) {
205206
if (isset(self::$deprecated[$use]) && strncmp($ns, $use, $len)) {
206207
$type = class_exists($name, false) ? 'class' : (interface_exists($name, false) ? 'interface' : 'trait');
207208
$verb = class_exists($use, false) || interface_exists($name, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
@@ -366,15 +367,16 @@ public function loadClass($class)
366367
/**
367368
* `class_implements` includes interfaces from the parents so we have to manually exclude them.
368369
*
369-
* @param string $class
370+
* @param string $class
371+
* @param string|false $parent
370372
*
371373
* @return string[]
372374
*/
373-
private function getOwnInterfaces($class)
375+
private function getOwnInterfaces($class, $parent)
374376
{
375377
$ownInterfaces = class_implements($class, false);
376378

377-
if ($parent = get_parent_class($class)) {
379+
if ($parent) {
378380
foreach (class_implements($parent, false) as $interface) {
379381
unset($ownInterfaces[$interface]);
380382
}

src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsInternals', true);
347347
restore_error_handler();
348348

349349
$this->assertSame($deprecations, array(
350-
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
351350
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
351+
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
352352
'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
353353
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
354354
));

0 commit comments

Comments
 (0)