Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace E_USER_NOTICE with E_USER_DEPRECATED #647

Merged
merged 2 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
forceCoversAnnotation="true"
processIsolation="false"
stopOnError="false"
Expand Down
4 changes: 2 additions & 2 deletions src/SDK/Common/Dev/Compatibility/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}
}
6 changes: 3 additions & 3 deletions tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down