24

I am using Symfony 3.4.12 and can't find any information about how to solve this deprecation:

User Deprecated: Doctrine\Common\ClassLoader is deprecated.

Any suggestion?

2 Answers 2

22

The Doctrine Common package will be split into small packages and the ClassLoader component will be dropped, that's why the deprecation notice. See https://github.com/doctrine/common/issues/826 and https://www.doctrine-project.org/2018/07/12/common-2-9-and-dbal-2-8-and-orm-2-6-2.html.

If you are using the package doctrine/common directly then the solution would be to remove that dependency and add the individual packages instead. If you are using Symfony there is already a PR to change that: https://github.com/symfony/symfony/pull/27609. So in any new version, the deprecation should be gone.

9
  • 2
    For now I think there is nothing you can do by yourself. However after symfony releases a new version which includes the PR on my answer, the deprecation notice should automatically go away. Jul 15, 2018 at 13:51
  • 1
    Great! Many Thanks!
    – Mutatos
    Jul 16, 2018 at 5:51
  • 8
    2018 get still this warning
    – es cologne
    Sep 21, 2018 at 7:29
  • 3
    My logs are spammed by this message, how can I suppress it temporarily?
    – olidem
    Oct 19, 2018 at 13:24
  • 1
    using symfony 4.1.7 but still getting this error. :(
    – Tariq Khan
    Nov 19, 2018 at 12:17
1

In this case (https://pasteboard.co/HJOKbzk.png), we have 2 ways:

- when running phpunit in console set environment variable, like this:

$ SYMFONY_DEPRECATIONS_HELPER=weak ./vendor/bin/phpunit

show simple notice in result: Remaining deprecation notices (1) (https://pasteboard.co/HJONdvJ.png)

besides, we can use this option:

$ SYMFONY_DEPRECATIONS_HELPER=weak_vendors ./vendor/bin/phpunit

we will get a more strict warning (https://pasteboard.co/HJOOZH9.png)

- we can also add a variable to the phpunit configuration (phpunit.xml[.dist])

<phpunit ...>
    <php>
        ...
        <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors" />
1
  • 1
    To omit all the deprecated messages (caution with this): <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" /> Oct 26, 2018 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.