Suppress quot;Ambiguous class resolutionquot; warning on composer dump-autoload -o(抑制“歧义类解析对作曲家 dump-autoload -o 的警告)
问题描述
我处于以下情况:
我想在 openshift 上通过git push"部署一个 php 应用程序.依赖项通过 Composer 解决.composer.lock 文件(将依赖项锁定到所需的特定版本)是存储库的一部分.
使用 deploy 钩子脚本加载依赖项:
${PHP_DIR}/bin/php $OPENSHIFT_DATA_DIR/composer.phar update --prefer-dist --no-dev -n${PHP_DIR}/bin/php $OPENSHIFT_DATA_DIR/composer.phar dump-autoload --optimize -n依赖项之一(htmlpurifier)是子依赖项的依赖项.在第二个命令 (dump-autoload --optimize) 期间,一个错误抱怨歧义类解析"-警告被写入 stderr(我想),导致部署失败.代码使用单元/集成测试在本地进行测试,并被证明可以工作,即使使用这个错误的包也是如此.
<块引用>远程:警告:类解析不明确,在/var/lib"中都找到了HTML5"/openshift/abc/app-root/runtime/repo/vendor/ezyang/htmlpurifier/maintenance/PH5P.php"和/var/lib/openshift/abc/app-root/runtime/repo/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/PH5P.php",将使用第一个.
他们是否可以忽略此特定警告(例如未记录的选项),而不忽略命令生成的所有其他警告和/或消息?或者是否可以从自动加载优化中排除特定的子依赖项以避免警告并让部署成功而不忽略所有可能的错误?
经过对 composer-user 列表的讨论,此问题已在
https://github.com/composer/composer/commit/05d9912f97a2097dfa2f95a20cdf6d/p>
如果其他人遇到此问题,请使用
将 Composer 更新到最新版本作曲家自我更新I'm in the follwoing situation:
I want to deploy a php-app via "git push" on openshift. Dependencies are resolved via composer. The composer.lock file (locking the dependencies to the specific wanted version) is part of the repository.
Dependencies are loaded using the deploy hook script using:
${PHP_DIR}/bin/php $OPENSHIFT_DATA_DIR/composer.phar update --prefer-dist --no-dev -n
${PHP_DIR}/bin/php $OPENSHIFT_DATA_DIR/composer.phar dump-autoload --optimize -n
One of the dependencies (htmlpurifier) is a dependency of a subdependency. During the second command (dump-autoload --optimize) an error complaining about a "Ambiguous class resolution"-warning is written to stderr(I suppose), causing the deploy to fail. Code is tested locally using unit/integration tests and proven to work, even with this erroneous package.
remote: Warning: Ambiguous class resolution, "HTML5" was found in both "/var/lib /openshift/abc/app-root/runtime/repo/vendor/ezyang/htmlpuri fier/maintenance/PH5P.php" and "/var/lib/openshift/abc/app- root/runtime/repo/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/PH5P.php ", the first will be used.
Is their a way to ignore this specific warning (e.g. an undocumented option), without ignoring all other warnings and/or messages generated by the command? Or is it possible to exclude a specific subdependency from autoload optimization to avoid the warning and let deploy succeed without ignoring all possible errors?
After a discussion on the composer-user list this has been fixed in
https://github.com/composer/composer/commit/05d9912f97a2decf6a5c08dfa569dcf23d79b16d
If anyone else runs into this, update composer to the latest version using
composer selfupdate
这篇关于抑制“歧义类解析"对作曲家 dump-autoload -o 的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:抑制“歧义类解析"对作曲家 dump-autoload -o 的警告
基础教程推荐
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
