Stop relying on the $mode argument

When registering the error handler, simple-phpunit might be used, and in
that case, the bootstrap process will not have environment variables
defined inside phpunit.xml.dist . This means `$mode` might differ when
registering the error handler, and when an error is triggered.
This raises a question: should the $mode argument be removed to avoid
similar errors in the future?
This commit is contained in:
Grégoire Paris 2017-03-13 12:11:00 +01:00
parent 40d133c29a
commit 0d180d5994
No known key found for this signature in database
GPG Key ID: F30226DD290FCB25

View File

@ -90,17 +90,13 @@ class DeprecationErrorHandler
'remainingCount' => 0,
'legacyCount' => 0,
'otherCount' => 0,
'remaining vendorCount' => 0,
'unsilenced' => array(),
'remaining' => array(),
'legacy' => array(),
'other' => array(),
'remaining vendor' => array(),
);
if (self::MODE_WEAK_VENDORS === $mode) {
$deprecations += array(
'remaining vendorCount' => 0,
'remaining vendor' => array(),
);
}
$deprecationHandler = function ($type, $msg, $file, $line, $context) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) {
$mode = $getMode();
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) {