diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index ce5472a1b88f63a2358b74ebbb15ee2a20c85672..c4283234b8679c5d8048f54feef75aa51498cdf2 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -2221,18 +2221,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Call to deprecated method expectWarning\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: -https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Call to deprecated method expectWarningMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\: -https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#', 'count' => 1, diff --git a/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php b/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php index 5c1079b9e0c78a9dba0e21d577753fbf06fa2bdf..f95108a93159f4cf9f0ea915599dd89da77a23ea 100644 --- a/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php +++ b/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php @@ -37,7 +37,6 @@ trait DoTrustedCallbackTrait { * @param string $error_type * (optional) The type of error to trigger. One of: * - TrustedCallbackInterface::THROW_EXCEPTION - * - TrustedCallbackInterface::TRIGGER_WARNING * - TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION * Defaults to TrustedCallbackInterface::THROW_EXCEPTION. * @param string $extra_trusted_interface @@ -99,9 +98,6 @@ public function doTrustedCallback(callable $callback, array $args, $message, $er if ($error_type === TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION) { @trigger_error($message, E_USER_DEPRECATED); } - elseif ($error_type === TrustedCallbackInterface::TRIGGER_WARNING) { - trigger_error($message, E_USER_WARNING); - } else { throw new UntrustedCallbackException($message); } diff --git a/core/lib/Drupal/Core/Security/StaticTrustedCallbackHelper.php b/core/lib/Drupal/Core/Security/StaticTrustedCallbackHelper.php index f406c7a278d90192c84676b6834ae4b9e6d329b0..0e31a933ed4f4128a5a1d4dace661216ec52b6c0 100644 --- a/core/lib/Drupal/Core/Security/StaticTrustedCallbackHelper.php +++ b/core/lib/Drupal/Core/Security/StaticTrustedCallbackHelper.php @@ -23,7 +23,6 @@ class StaticTrustedCallbackHelper { * @param string $error_type * (optional) The type of error to trigger. One of: * - TrustedCallbackInterface::THROW_EXCEPTION - * - TrustedCallbackInterface::TRIGGER_WARNING * - TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION * Defaults to TrustedCallbackInterface::THROW_EXCEPTION. * @param string $extra_trusted_interface diff --git a/core/lib/Drupal/Core/Security/TrustedCallbackInterface.php b/core/lib/Drupal/Core/Security/TrustedCallbackInterface.php index 78f6bb934393323ad7054b4e0df9f9cdb041ff18..e4fd28382ea9ca81cbc5d27216c6c6404aab57da 100644 --- a/core/lib/Drupal/Core/Security/TrustedCallbackInterface.php +++ b/core/lib/Drupal/Core/Security/TrustedCallbackInterface.php @@ -14,11 +14,6 @@ interface TrustedCallbackInterface { */ const THROW_EXCEPTION = 'exception'; - /** - * Untrusted callbacks trigger E_USER_WARNING errors. - */ - const TRIGGER_WARNING = 'warning'; - /** * Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. */ diff --git a/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php b/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php index a97a5b6ab68416fe9d7fb0e70ecb6f2211bfd579..60b454ac5fff62fc58826ec4b94542ade4848e21 100644 --- a/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php @@ -87,15 +87,6 @@ public function testSilencedDeprecation($callback) { $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION); } - /** - * @dataProvider errorTypeProvider - */ - public function testWarning($callback) { - $this->expectWarning(); - $this->expectWarningMessage('Drupal\Tests\Core\Security\UntrustedObject::callback is not trusted'); - $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::TRIGGER_WARNING); - } - /** * Data provider for tests of ::doTrustedCallback $error_type argument. */