承接 therealworld/suppress-deprecations-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

therealworld/suppress-deprecations-plugin

最新稳定版本:v1.0.5

Composer 安装命令:

composer require therealworld/suppress-deprecations-plugin

包简介

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

README 文档

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.

统计信息

  • 总下载量: 48
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2026-04-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固