Skip to content

Commit 75af4c1

Browse files
committed
feature #36034 [PhpUnitBridge] Deprecate @expectedDeprecation annotation (hkdobrev)
This PR was squashed before being merged into the 5.1-dev branch. Discussion ---------- [PhpUnitBridge] Deprecate @expectedDeprecation annotation | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes<!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A | License | MIT | Doc PR | N/A Addresses https://github.com/orgs/symfony/projects/1#card-32934769 as a follow-up to #35192. Deprecating `@expectedDeprecation` annotation on tests in favour of the `expectDeprecation()` method similar to other PHPUnit deprecations of annotations in favour of methods. Commits ------- 36a57cc7c2 [PhpUnitBridge] Deprecate @expectedDeprecation annotation
2 parents 85d3760 + d5db219 commit 75af4c1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* ignore verbosity settings when the build fails because of deprecations
88
* added per-group verbosity
99
* added `ExpectDeprecationTrait` to be able to define an expected deprecation from inside a test
10+
* deprecated the `@expectedDeprecation` annotation, use the `ExpectDeprecationTrait::expectDeprecation()` method instead
1011

1112
5.0.0
1213
-----

Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function startTest($test)
226226
if (isset($annotations['method']['expectedDeprecation'])) {
227227
self::$expectedDeprecations = $annotations['method']['expectedDeprecation'];
228228
self::$previousErrorHandler = set_error_handler([self::class, 'handleError']);
229+
@trigger_error('Since symfony/phpunit-bridge 5.1: Using "@expectedDeprecation" annotations in tests is deprecated, use the "ExpectDeprecationTrait::expectDeprecation()" method instead.', E_USER_DEPRECATED);
229230
}
230231

231232
if ($this->checkNumAssertions) {

0 commit comments

Comments
 (0)