diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f04f21c18..73b86f0a5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,6 +11,7 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" + convertDeprecationsToExceptions="true" forceCoversAnnotation="true" processIsolation="false" stopOnError="false" diff --git a/src/SDK/Common/Dev/Compatibility/Util.php b/src/SDK/Common/Dev/Compatibility/Util.php index 7566ed218..5b84015ce 100644 --- a/src/SDK/Common/Dev/Compatibility/Util.php +++ b/src/SDK/Common/Dev/Compatibility/Util.php @@ -17,7 +17,7 @@ public static function triggerClassDeprecationNotice(string $className, string $ $notice .= sprintf('Please, use "%s" instead.', $alternativeClassName); } - trigger_error($notice, E_USER_NOTICE); + trigger_error($notice, \E_USER_DEPRECATED); } public static function triggerMethodDeprecationNotice( @@ -38,6 +38,6 @@ public static function triggerMethodDeprecationNotice( $notice .= sprintf('Please, use "%s" instead.', $method); } - trigger_error($notice, E_USER_NOTICE); + trigger_error($notice, \E_USER_DEPRECATED); } } diff --git a/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php b/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php index 5398bd478..f2290c614 100644 --- a/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php +++ b/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php @@ -14,21 +14,21 @@ class UtilTest extends TestCase { public function test_trigger_class_deprecation_notice(): void { - $this->expectNotice(); + $this->expectDeprecation(); Util::triggerClassDeprecationNotice(Util::class, self::class); } public function test_trigger_method_deprecation_notice_without_class(): void { - $this->expectNotice(); + $this->expectDeprecation(); Util::triggerMethodDeprecationNotice(Util::class, __METHOD__); } public function test_trigger_method_deprecation_notice_with_class(): void { - $this->expectNotice(); + $this->expectDeprecation(); Util::triggerMethodDeprecationNotice(Util::class, 'foo', self::class); }