在我的composer.json文件中波浪号(〜)是什么意思? [英] What does the tilde (~) mean in my composer.json file?

查看:590
本文介绍了在我的composer.json文件中波浪号(〜)是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的composer.json文件中有这一行:

I have this line in my composer.json file:

"require": {
    ...
    "friendsofsymfony/user-bundle": "~2.0@dev",
    ...
},

~2.0@dev 中的符号是什么意思?是一个占位符,并且应该总是获取 1.2.0 2.2.0 3.2.0 等等?没有意义(并且通过 * 通配符)。

What does the tilde ~ in ~2.0@dev exactly mean? Is that a placeholder and shall always fetch the subversions like 1.2.0, 2.2.0, 3.2.0 and so on? Doesn't make sense (and would be done by the * wildcard).

composer.json文档不会说明任何关于波浪号的信息。

The composer.json documentation doesn't tell anything about the tilde.

我因为我刚刚阅读了关于Symfony博客中的安全问题,他们建议升级到1.3.3版本。但是找出FOSUserBundle的版本并不容易(我找不到包含该版本的文件)。

I am asking because I just read about a security issue in the Symfony blog and they recommend to upgrade to version 1.3.3. But figuring out the FOSUserBundle's version isn't that easy (I couldn't find a file that contains the version).

推荐答案

Tilde表示下一个重要发布。在你的情况下,它等价于> = 2.0,< 3.0

Tilde means next significant release. In your case, it is equivalent to >= 2.0, < 3.0.

完整说明在 https://getcomposer.org/doc/articles/versions.md#tilde


另一种查看方式它是使用〜指定最小
版本,但允许指定的最后一个数字上升。

Another way of looking at it is that using ~ specifies a minimum version, but allows the last digit specified to go up.

编辑:Seldeak以下评论是对作曲家文档的简单总结说明;)

edit: Seldeak below comment is a simple sum up explanation of composer documentation ;)

这篇关于在我的composer.json文件中波浪号(〜)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆