therealworld/suppress-deprecations-plugin

Suppresses Symfony deprecation notices during Composer operations in legacy OXID 6 projects

Maintainers

Package info

bitbucket.org/therealworld/suppress-plugin

Type:composer-plugin

pkg:composer/therealworld/suppress-deprecations-plugin

Statistics

Installs: 33

Dependents: 1

Suggesters: 0

v1.0.5 2026-04-15 17:59 UTC

This package is auto-updated.

Last update: 2026-04-15 18:00:15 UTC


README

Composer plugin to suppress noisy deprecation notices during composer update / composer install in legacy OXID 6 projects.

Problem

When running Composer commands in OXID 6 projects with current PHP and Composer versions, the console is flooded with non-actionable messages:

Deprecation Notice: Since symfony/event-dispatcher 5.3: Configuring "Symfony\Component\EventDispatcher\..." is deprecated.
Deprecation Notice: Since oxid-esales/oxideshop-ce 6.5.0: The "oxid_esales.module.configuration..." service is deprecated.

These messages cannot be suppressed using PHP's error_reporting because Composer registers its own error handler that explicitly catches and outputs E_USER_DEPRECATED notices.

Solution

The plugin installs a wrapper error handler that intercepts E_USER_DEPRECATED and E_DEPRECATED notices and silently discards them. All other error levels are forwarded to Composer's original ErrorHandler.

Note: Abandoned package warnings ("Package X is abandoned, you should avoid using it.") are printed directly by Composer's Installer via IOInterface::writeError() and cannot be reliably intercepted from a plugin. These warnings are accepted as-is.

Installation

As a dependency of another package (recommended)

In the composer.json of a parent package (e.g. therealworld/clirun-plugin):

{
    "require": {
        "therealworld/suppress-deprecations-plugin": "^1.0"
    }
}

The plugin must be allowed in the project's root composer.json:

{
    "config": {
        "allow-plugins": {
            "therealworld/suppress-deprecations-plugin": true
        }
    }
}

Tip: A wildcard entry covers all therealworld plugins:

{
    "config": {
        "allow-plugins": {
            "therealworld/*": true
        }
    }
}

As a local path repository (for testing)

{
    "repositories": [
        {"type": "path", "url": "extensions/trw/composer"}
    ],
    "require": {
        "therealworld/suppress-deprecations-plugin": "*"
    }
}

Fallback: auto_prepend_file

For the very first composer update (before the plugin is installed), the included suppress-deprecations.php can be used as a PHP prepend file:

php -d auto_prepend_file=extensions/trw/composer/suppress-deprecations.php composer update

This file defines trigger_deprecation() as a no-op before Symfony's version is loaded. From the second run onwards, the plugin takes over.

Files

FilePurpose
src/SuppressDeprecationsPlugin.phpComposer plugin: error handler wrapper
suppress-deprecations.phpFallback: no-op trigger_deprecation() for auto_prepend_file

Technical Background

Why not autoload.files?

Composer's AutoloadGenerator always sorts the root package to the end of the autoload file list ($sortedPackageMap[] = $rootPackageMap). Dependencies are sorted by "importance" (number of dependent packages). symfony/deprecation-contracts has a very high weight and is therefore always loaded before any custom package. Overriding via autoload.files is not possible.

Why not error_reporting?

Composer's ErrorHandler::handle() explicitly checks:

$isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED;
if (!$isDeprecationNotice && !(error_reporting() & $level)) {
    return true;
}

Deprecation notices bypass the error_reporting check entirely.