Skip to content

Commit e92b387

Browse files
[ErrorHandler] Skip @method deprecations for symfony/* packages, but for symfony/symfony
1 parent 30dd608 commit e92b387

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\ErrorHandler;
1313

14+
use Composer\InstalledVersions;
1415
use Doctrine\Common\Persistence\Proxy as LegacyProxy;
1516
use Doctrine\Persistence\Proxy;
1617
use Mockery\MockInterface;
@@ -183,6 +184,7 @@ class DebugClassLoader
183184

184185
public function __construct(callable $classLoader)
185186
{
187+
class_exists(InstalledVersions::class);
186188
$this->classLoader = $classLoader;
187189
$this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
188190
parse_str(getenv('SYMFONY_PATCH_TYPE_DECLARATIONS') ?: '', $this->patchTypes);
@@ -492,6 +494,13 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
492494
self::$method[$class] = self::$method[$use];
493495
}
494496
} elseif (!$refl->isInterface()) {
497+
if (!strncmp($vendor, str_replace('_', '\\', $use), $vendorLen)
498+
&& class_exists(InstalledVersions::class, false)
499+
&& 0 === strpos($root = InstalledVersions::getRootPackage()['name'], 'symfony/')
500+
&& 'symfony/symfony' !== $root
501+
) {
502+
continue; // skip @method deprecations for symfony/* packages, but for symfony/symfony
503+
}
495504
$hasCall = $refl->hasMethod('__call');
496505
$hasStaticCall = $refl->hasMethod('__callStatic');
497506
foreach (self::$method[$use] as $method) {

0 commit comments

Comments
 (0)