sebastianbergmann / sebastianbergmann/phpunit

Move/Rename events for issues triggered outside of tests

Open
#6,580 0 comments 0 reactions 1 assignee View on GitHub

@sebastianbergmann is already working on this.

Since Apr 11, 2026.

feature/events type/backward-compatibility type/refactoring
Dominant language
PHP
Stars
20.1k
Forks
2.2k
Avg merge
7h
Merged PRs (30d)
61

Description

The new events introduced in #6579 for E_USER_DEPRECATION, E_USER_NOTICE, and E_USER_WARNING triggered outside of tests would naturally live in the PHPUnit\Event\TestRunner namespace as DeprecationTriggered, NoticeTriggered, and WarningTriggered. However, those names are already taken by existing event classes that represent something entirely different:

Current name What it represents Should have been named
TestRunner\DeprecationTriggered PHPUnit itself reporting a deprecation about the test runner TestRunner\PhpunitDeprecationTriggered
TestRunner\NoticeTriggered PHPUnit itself reporting a notice about the test runner TestRunner\PhpunitNoticeTriggered
TestRunner\WarningTriggered PHPUnit itself reporting a warning about the test runner TestRunner\PhpunitWarningTriggered

The regular deprecation process (deprecate old name, introduce new name, give consumers a migration window) cannot be applied here. After the renames, TestRunner\DeprecationTriggered would still exist but with a completely different meaning. Any subscriber implementing TestRunner\DeprecationTriggeredSubscriber would 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\Issue sub-namespace as a temporary home. The @todo annotations document the plan for PHPUnit 14:

  • The existing TestRunner\DeprecationTriggered (and NoticeTriggered, WarningTriggered) will be renamed to TestRunner\PhpunitDeprecationTriggered (and PhpunitNoticeTriggered, PhpunitWarningTriggered)
  • The new TestRunner\Issue\DeprecationTriggered (and NoticeTriggered, WarningTriggered) will be moved up to TestRunner\DeprecationTriggered (and NoticeTriggered, WarningTriggered)
  • The same applies to the corresponding Subscriber interfaces

This must be a hard break in PHPUnit 14 because both sides of the collision need to be reshuffled simultaneously.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.