Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: use Doctrine\Common\Annotations\AnnotationRegistry; Chris@0: use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; Chris@0: Chris@14: // Detect if we need to serialize deprecations to a file. Chris@14: if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) { Chris@14: DeprecationErrorHandler::collectDeprecations($file); Chris@14: Chris@14: return; Chris@14: } Chris@14: Chris@0: // Detect if we're loaded by an actual run of phpunit Chris@14: if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) { Chris@0: return; Chris@0: } Chris@0: Chris@0: // Enforce a consistent locale Chris@0: setlocale(LC_ALL, 'C'); Chris@0: Chris@0: if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) { Chris@14: if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) { Chris@14: AnnotationRegistry::registerUniqueLoader('class_exists'); Chris@14: } else { Chris@14: AnnotationRegistry::registerLoader('class_exists'); Chris@14: } Chris@0: } Chris@0: Chris@0: if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) { Chris@0: DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER')); Chris@0: }