3636484634
* 2.7: (22 commits) [DependencyInjection] deprecated synchronized services [FrameworkBundle] adds legacy tests for deprecated configuration keys. [TwigBundle] adds legacy tests for deprecated configuration keys. [PropertyAccessor] Added test to allow null value for a array [Yaml] Fixed #10597: Improved Yaml directive parsing [Validator] always use the lazy loading metadata factory [Validator] removed usage of deprecated getMessageParameters() and getMessagePluralization() in unit tests [Validator] fixed deprecation notices for BuildViolation() calls in constraints [Validator] fixed usage of deprecate Validator features [Validator] removed obsolete code removed the Validator BC layer for PHP < 5.3.9 removed code for PHP < 5.3.9 bumped min PHP version to 5.3.9 fixed deprecation summary and missing error_reporting() in tests [Form] Fixed check of violation constraint #12792 [FrameworkBundle] adds deprecation notice on framework.csrf_protection.field_name configuration key. [TwigBundle] adds missing deprecation notice for the twig.form.resources configuration key. [FrameworkBundle] avoid using deprecated classes for reflection [FrameworkBundle] Add a test case for service aliases used with AddExpressionLanguageProviderPass. [FrameworkBundle] fixed #12847 AddExpressionLanguageProviderPass ... Conflicts: .travis.yml composer.json src/Symfony/Bridge/Doctrine/composer.json src/Symfony/Bridge/Monolog/composer.json src/Symfony/Bridge/Propel1/composer.json src/Symfony/Bridge/ProxyManager/composer.json src/Symfony/Bridge/Swiftmailer/composer.json src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/DebugBundle/composer.json src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Bundle/SecurityBundle/composer.json src/Symfony/Bundle/TwigBundle/composer.json src/Symfony/Bundle/WebProfilerBundle/composer.json src/Symfony/Component/BrowserKit/composer.json src/Symfony/Component/ClassLoader/composer.json src/Symfony/Component/Config/composer.json src/Symfony/Component/Console/composer.json src/Symfony/Component/CssSelector/composer.json src/Symfony/Component/Debug/composer.json src/Symfony/Component/DependencyInjection/composer.json src/Symfony/Component/DomCrawler/composer.json src/Symfony/Component/EventDispatcher/composer.json src/Symfony/Component/ExpressionLanguage/composer.json src/Symfony/Component/Filesystem/composer.json src/Symfony/Component/Finder/composer.json src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php src/Symfony/Component/Form/composer.json src/Symfony/Component/HttpFoundation/composer.json src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php src/Symfony/Component/HttpKernel/composer.json src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php src/Symfony/Component/Intl/composer.json src/Symfony/Component/Locale/composer.json src/Symfony/Component/OptionsResolver/composer.json src/Symfony/Component/Process/composer.json src/Symfony/Component/PropertyAccess/composer.json src/Symfony/Component/Routing/composer.json src/Symfony/Component/Security/Acl/composer.json src/Symfony/Component/Security/Core/composer.json src/Symfony/Component/Security/Csrf/composer.json src/Symfony/Component/Security/Http/composer.json src/Symfony/Component/Security/composer.json src/Symfony/Component/Serializer/composer.json src/Symfony/Component/Stopwatch/composer.json src/Symfony/Component/Templating/composer.json src/Symfony/Component/Translation/composer.json src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php src/Symfony/Component/Validator/composer.json src/Symfony/Component/VarDumper/composer.json src/Symfony/Component/Yaml/composer.json
134 lines
4.8 KiB
Plaintext
134 lines
4.8 KiB
Plaintext
<?php
|
|
|
|
// Disabling Zend Garbage Collection to prevent segfaults
|
|
// https://bugs.php.net/bug.php?id=53976
|
|
if (gc_enabled()) {
|
|
gc_disable();
|
|
}
|
|
|
|
/**
|
|
* Catch deprecation notices and print a summary report at the end of the test suite
|
|
*
|
|
* @internal
|
|
*/
|
|
class DeprecationErrorHandler
|
|
{
|
|
private static $isRegistered = false;
|
|
|
|
public static function register()
|
|
{
|
|
if (self::$isRegistered) {
|
|
return;
|
|
}
|
|
$deprecations = array(
|
|
'remainingCount' => 0,
|
|
'legacyCount' => 0,
|
|
'otherCount' => 0,
|
|
'remaining' => array(),
|
|
'legacy' => array(),
|
|
'other' => array(),
|
|
);
|
|
$deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations) {
|
|
if (E_USER_DEPRECATED !== $type) {
|
|
return PHPUnit_Util_ErrorHandler::handleError($type, $msg, $file, $line, $context);
|
|
}
|
|
|
|
$trace = debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT : true);
|
|
|
|
$i = count($trace);
|
|
while (isset($trace[--$i]['class']) && ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_'))) {
|
|
// No-op
|
|
}
|
|
|
|
if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
|
|
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
|
|
$method = $trace[$i]['function'];
|
|
|
|
$type = 0 === strpos($method, 'testLegacy') || 0 === strpos($method, 'provideLegacy') || 0 === strpos($method, 'getLegacy') || strpos($class, '\Legacy') ? 'legacy' : 'remaining';
|
|
|
|
if ('legacy' === $type && 0 === (error_reporting() & E_USER_DEPRECATED)) {
|
|
@++$deprecations[$type]['Silenced']['count'];
|
|
} else {
|
|
@++$deprecations[$type][$msg]['count'];
|
|
@++$deprecations[$type][$msg][$class.'::'.$method];
|
|
}
|
|
} else {
|
|
$type = 'other';
|
|
@++$deprecations[$type][$msg]['count'];
|
|
}
|
|
++$deprecations[$type.'Count'];
|
|
};
|
|
$oldErrorHandler = set_error_handler($deprecationHandler);
|
|
|
|
if (null !== $oldErrorHandler) {
|
|
restore_error_handler();
|
|
if (array('PHPUnit_Util_ErrorHandler', 'handleError') === $oldErrorHandler) {
|
|
restore_error_handler();
|
|
self::register();
|
|
}
|
|
} else {
|
|
self::$isRegistered = true;
|
|
register_shutdown_function(function () use (&$deprecations, $deprecationHandler) {
|
|
|
|
$colorize = new \SebastianBergmann\Environment\Console();
|
|
|
|
if ($colorize->hasColorSupport()) {
|
|
$colorize = function ($str, $red) {
|
|
$color = $red ? '41;37' : '43;30';
|
|
|
|
return "\x1B[{$color}m{$str}\x1B[0m";
|
|
};
|
|
} else {
|
|
$colorize = function ($str) {return $str;};
|
|
}
|
|
|
|
$currErrorHandler = set_error_handler('var_dump');
|
|
restore_error_handler();
|
|
|
|
if ($currErrorHandler !== $deprecationHandler) {
|
|
echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n";
|
|
}
|
|
|
|
$cmp = function ($a, $b) {
|
|
return $b['count'] - $a['count'];
|
|
};
|
|
|
|
foreach (array('remaining', 'legacy', 'other') as $type) {
|
|
if ($deprecations[$type]) {
|
|
echo "\n", $colorize(sprintf('%s deprecation notices (%d)', ucfirst($type), $deprecations[$type.'Count']), 'legacy' !== $type), "\n";
|
|
|
|
uasort($deprecations[$type], $cmp);
|
|
|
|
foreach ($deprecations[$type] as $msg => $notices) {
|
|
echo "\n", $msg, ': ', $notices['count'], "x\n";
|
|
|
|
arsort($notices);
|
|
|
|
foreach ($notices as $method => $count) {
|
|
if ('count' !== $method) {
|
|
echo ' ', $count, 'x in ', preg_replace('/(.*)\\\\(.*?::.*?)$/', '$2 from $1', $method), "\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!empty($notices)) {
|
|
echo "\n";
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
if (class_exists('PHPUnit_Util_ErrorHandler')) {
|
|
DeprecationErrorHandler::register();
|
|
}
|
|
|
|
$loader = require_once __DIR__.'/vendor/autoload.php';
|
|
|
|
use Doctrine\Common\Annotations\AnnotationRegistry;
|
|
|
|
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
|
|
|
|
return $loader;
|