Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User Deprecated: Doctrine\Common\ClassLoader is deprecated

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?

like image 937
Mutatos Avatar asked Jul 14 '18 18:07

Mutatos


2 Answers

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.

like image 55
João Alves Avatar answered Nov 08 '22 13:11

João Alves


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" />
like image 1
Shock Avatar answered Nov 08 '22 13:11

Shock