Skip to content
Snippets Groups Projects
Commit f56323ab authored by catch's avatar catch
Browse files

Issue #3240456 by alexpott, andypost, daffie: Allow E_DEPRECATED deprecations...

Issue #3240456 by alexpott, andypost, daffie: Allow E_DEPRECATED deprecations to be skipped so we can test on PHP 8.1
parent 09cf3153
No related branches found
No related tags found
13 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1896Issue #2940605: Can only intentionally re-render an entity with references 20 times,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!512Issue #3207771: Menu UI node type form documentation points to non-existent function,!485Sets the autocomplete attribute for username/password input field on login form.,!449Issue #2784233: Allow multiple vocabularies in the taxonomy filter,!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev,!43Resolve #3173180: Add UI for 'loading' html attribute to images,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -76,6 +76,12 @@ public static function isDeprecationSkipped($message) {
// issues and thus were not addressed in time for the 9.0.0 release.
'%The entity link url update for the "\w+" view is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Module-provided Views configuration should be updated to accommodate the changes described at https://www.drupal.org/node/2857891.%',
'%The operator defaults update for the "\w+" view is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Module-provided Views configuration should be updated to accommodate the changes described at https://www.drupal.org/node/2869168.%',
// Guzzle 6 will not be updated for full PHP 8.1 compatibility, see
// https://github.com/guzzle/guzzle/pull/2918.
'%Return type of GuzzleHttp\\\\.* should either be compatible with .*, or the #\[\\\\ReturnTypeWillChange\] attribute should be used to temporarily suppress the notice%',
// Skip EasyRdf deprecations for PHP 8.1 - fixed by
// https://github.com/easyrdf/easyrdf/pull/384.
'%Return type of EasyRdf\\\\.* should either be compatible with .*, or the #\[\\\\ReturnTypeWillChange\] attribute should be used to temporarily suppress the notice%',
];
return (bool) preg_filter($dynamic_skipped_deprecations, '$0', $message);
}
......@@ -98,8 +104,9 @@ public static function isDeprecationSkipped($message) {
*/
public static function getSkippedDeprecations() {
return [
// The following deprecation message is skipped for testing purposes.
// The following deprecation messages are skipped for testing purposes.
'\Drupal\Tests\SkippedDeprecationTest deprecation',
'Return type of PhpDeprecation::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice',
// The following Symfony deprecations are introduced in the Symfony 4
// development cycle. They will need to be resolved prior to Symfony 5
// compatibility.
......@@ -136,7 +143,7 @@ protected function registerErrorHandler() {
}
$deprecation_handler = function ($type, $msg, $file, $line, $context = []) {
// Skip listed deprecations.
if ($type === E_USER_DEPRECATED && static::isDeprecationSkipped($msg)) {
if (($type === E_USER_DEPRECATED || $type === E_DEPRECATED) && static::isDeprecationSkipped($msg)) {
return;
}
return call_user_func($this->previousHandler, $type, $msg, $file, $line, $context);
......
......@@ -27,4 +27,14 @@ public function testSkippingDeprecationsAgain() {
$this->addToAssertionCount(1);
}
/**
* Tests skipping E_DEPRECATED deprecations in unit tests.
*
* @see \Drupal\Tests\Listeners\DeprecationListenerTrait::getSkippedDeprecations()
*/
public function testSkippingPhpDeprecations() {
include_once __DIR__ . '/../../fixtures/deprecated_code.php';
$this->addToAssertionCount(1);
}
}
<?php
// @phpcs:ignoreFile
/**
* This class triggers an E_DEPRECATED notice.
*
* @see
*/
class PhpDeprecation implements \IteratorAggregate {
/**
* {@inheritdoc}
*/
public function getIterator() {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment