Skip to content

#273 - Use trigger_deprecation() instead of trigger_error(E_USER_DEPRECATED) - #286

Merged
njoubert-cleverage merged 1 commit into
mainfrom
273
Oct 14, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
273

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #273: trigger the deprecations with trigger_deprecation() (symfony/deprecation-contracts) instead of @trigger_error(..., E_USER_DEPRECATED). The messages are prefixed with the package and the version (Since cleverage/process-bundle 5.1: ...), and grouped as such by the PHPUnit bridge and the profiler.

Changes

  • Require symfony/deprecation-contracts ^2.5|^3 (already installed through the Symfony components; trigger_deprecation() has the same signature in both majors).
  • The 5 calls, with the version that introduced each deprecation:
Where Deprecation Version Source
CallbackTransformer additional_parameters option 2.0.4 0f02b54, first tag containing it
TaskConfiguration::getErrors() method (message now names it) 2.0.4 e533bef, first tag containing it
EventDispatcherTask class name listeners when event_name is set 5.1 #189 (CHANGELOG v5.1)
ProcessManager::initialize() going on after an initialization failure 5.1 #222 (CHANGELOG v5.1)
MappingTransformer non simple target property of an array destination 5.2 #117 (CHANGELOG v5.2)

"since v5" is removed from the two messages that had it (now given by the prefix); the rest of the messages is unchanged, except getErrors() ("Deprecated method, use getErrorOutputs instead" → The "…\TaskConfiguration::getErrors()" method is deprecated, use "getErrorOutputs()" instead.).

  • CHANGELOG (Latest).

Tests

  • Full expected messages for every deprecation: ProcessManagerInitializationTest, MappingTransformerTest, EventDispatcherTaskTest (exact message instead of a substring), new CallbackTransformerTest::testAdditionalParametersAreDeprecated (and none without the option), new TaskConfigurationTest::testGetErrorsIsDeprecated (assertContains: PHP 8.4+ also triggers its own deprecation for the #[\Deprecated] attribute of the method).
  • After composer update (PHP 8.5): 906 tests OK, PHPStan, PHP-CS-Fixer, Rector OK.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: same E_USER_DEPRECATED level and conditions. Code matching the exact deprecation messages (e.g. tests with expectUserDeprecationMessage()) must take the Since cleverage/process-bundle <version>: prefix into account.

🤖 Generated with Claude Code

…ECATED)

- Require symfony/deprecation-contracts (^2.5|^3, already installed through
  the Symfony components).
- Replace the 5 @trigger_error(..., E_USER_DEPRECATED) calls by
  trigger_deprecation('cleverage/process-bundle', <version>, ...), with the
  version that introduced each deprecation: 2.0.4 (CallbackTransformer
  additional_parameters, TaskConfiguration::getErrors()), 5.1 (EventDispatcherTask
  class name listeners #189, initialization failure #222), 5.2
  (MappingTransformer array target path #117). "since v5" removed from the
  messages, now given by the prefix.
- Tests: full messages of every deprecation (new TaskConfigurationTest and
  CallbackTransformerTest::testAdditionalParametersAreDeprecated).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use trigger_deprecation() instead of trigger_error(E_USER_DEPRECATED)

1 participant