| Q | A
|------------ | ------
| BC Break | yes
| Version | 2.6.2
After upgrading to 2.6.2, which included an upgrade to doctrine/common:2.9.0, PHPUnit now fails with:
1x: Doctrine\Common\ClassLoader is deprecated.
No deprecation errors were shown from using non-deprecated methods
Doctrine\Common\ClassLoader is deprecated
/Users/simon/projects/stokl/backend/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php:7
/Users/simon/projects/stokl/backend/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:1028
/Users/simon/projects/stokl/backend/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:266
/Users/simon/projects/stokl/backend/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:245
/Users/simon/projects/stokl/backend/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:305
/Users/simon/projects/stokl/backend/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/Users/simon/projects/stokl/backend/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:183
/Users/simon/projects/stokl/backend/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:89
This is from in a test case in a Symfony application
$entityManager =
$kernel->getContainer()->get('doctrine.orm.entity_manager');
$metadatas = $entityManager->getMetadataFactory()->getAllMetadata();
Hi,
thanks for a prompt testing of 2.6.2! Here's a quick fix: #7307
Note that the deprecations in doctrine/common are silent (using @) so nothing is really broken - your tests are explicitly using an unsilencer.
Your tests should be using weak_vendors mode for the Symfony's PHPUnit listener to ignore deprecations coming from vendor/ (those not triggered by your code). Otherwise your tests may start failing unexpectedly anytime and you won't be able to fix them as the code in question is out of scope.
Given the above, I am not convinced this would justify a 2.6.3 hotfix release. @Ocramius your thoughts?
I was not aware of that option. Certainly makes this less urgent! Thanks for telling me about it :)
How would you silence the deprecation in the Symfony WDT?
How would you silence the deprecation in the Symfony WDT?
It shouldn't be triggered in first place, vendor deprecations are not fault of your code and should be ignored. If this is the default behavior of Symfony WDT, then it's wrong behavior.
Either way this issue isn't the appropriate place to discuss configuration of Symfony or related issues. See https://github.com/symfony/symfony/issues/27936.
It's nice to know that despite what the warnings allude to, all's good with doctrine.
Closing here as resolved, fix will be released in 2.6.3.
Most helpful comment
Hi,
thanks for a prompt testing of 2.6.2! Here's a quick fix: #7307
Note that the deprecations in doctrine/common are silent (using
@) so nothing is really broken - your tests are explicitly using an unsilencer.Your tests should be using
weak_vendorsmode for the Symfony's PHPUnit listener to ignore deprecations coming fromvendor/(those not triggered by your code). Otherwise your tests may start failing unexpectedly anytime and you won't be able to fix them as the code in question is out of scope.Given the above, I am not convinced this would justify a 2.6.3 hotfix release. @Ocramius your thoughts?