-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Move/Rename events for issues triggered outside of tests #6580
Copy link
Copy link
Open
Labels
feature/eventsIssues related to PHPUnit's event systemIssues related to PHPUnit's event systemtype/backward-compatibilitySomething will be/is intentionally brokenSomething will be/is intentionally brokentype/refactoringA refactoring that should be applied to make the code easier to understand and maintainA refactoring that should be applied to make the code easier to understand and maintain
Milestone
Metadata
Metadata
Assignees
Labels
feature/eventsIssues related to PHPUnit's event systemIssues related to PHPUnit's event systemtype/backward-compatibilitySomething will be/is intentionally brokenSomething will be/is intentionally brokentype/refactoringA refactoring that should be applied to make the code easier to understand and maintainA refactoring that should be applied to make the code easier to understand and maintain
The new events introduced in #6579 for
E_USER_DEPRECATION,E_USER_NOTICE, andE_USER_WARNINGtriggered outside of tests would naturally live in thePHPUnit\Event\TestRunnernamespace asDeprecationTriggered,NoticeTriggered, andWarningTriggered. However, those names are already taken by existing event classes that represent something entirely different:TestRunner\DeprecationTriggeredTestRunner\PhpunitDeprecationTriggeredTestRunner\NoticeTriggeredTestRunner\PhpunitNoticeTriggeredTestRunner\WarningTriggeredTestRunner\PhpunitWarningTriggeredThe regular deprecation process (deprecate old name, introduce new name, give consumers a migration window) cannot be applied here. After the renames,
TestRunner\DeprecationTriggeredwould still exist but with a completely different meaning. Any subscriber implementingTestRunner\DeprecationTriggeredSubscriberwould receive a structurally different object. There is no way to have both the old and new meaning coexist under the same fully-qualified class name.For PHPUnit 13, the new events live in the
PHPUnit\Event\TestRunner\Issuesub-namespace as a temporary home. The@todoannotations document the plan for PHPUnit 14:TestRunner\DeprecationTriggered(andNoticeTriggered,WarningTriggered) will be renamed toTestRunner\PhpunitDeprecationTriggered(andPhpunitNoticeTriggered,PhpunitWarningTriggered)TestRunner\Issue\DeprecationTriggered(andNoticeTriggered,WarningTriggered) will be moved up toTestRunner\DeprecationTriggered(andNoticeTriggered,WarningTriggered)SubscriberinterfacesThis must be a hard break in PHPUnit 14 because both sides of the collision need to be reshuffled simultaneously.