persistence
persistence copied to clipboard
Fixes #97 - Preloading issues
Fixes: https://github.com/doctrine/persistence/issues/97
This PR add class_exists checks before calling the class_alias function. I decided to check to all class_alias functions.
This fixes the following warnings (in PHP8 RC5 with preloading enabled)
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Proxy in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Proxy.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Mapping\Driver\MappingDriver in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\AbstractManagerRegistry in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Mapping\ClassMetadata in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\Event\LifecycleEventArgs in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\ConnectionRegistry in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/ConnectionRegistry.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\ManagerRegistry in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/ManagerRegistry.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\ObjectRepository in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/ObjectRepository.php</b> on line <b>13</b><br />
<b>Warning</b>: Can't preload already declared class Doctrine\Common\Persistence\ObjectManager in <b>/var/www/html/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/ObjectManager.php</b> on line <b>13</b