抑制“歧义类解析"对作曲家 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
相关文章