Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer包警告unbound version constraints (xxx) should be avoided #75

Open
ionepub opened this issue Sep 6, 2018 · 0 comments
Open
Labels

Comments

@ionepub
Copy link
Owner

ionepub commented Sep 6, 2018

情境说明:

自定义创建一个composer包,使用 composer validate 命令检查 composer.json时提示警告内容

./composer.json is valid, but with a few warnings
See https://getcomposer.org/doc/04-schema.md for details on the schema
require.catfan/medoo : unbound version constraints (>=1.5) should be avoided

composer.json内容

{
    "name": "ionepub/region",
    "description": "desc",
    "type": "library",
    "autoload": {
		"psr-4": {"Ionepub\\": "src/"}
	},
    "license": "MIT",
    "require": {
		"catfan/medoo": ">=1.5"
	}
}

原因

在包中引用的medoo版本号写的不对,>=1.5表示对1.5版本以后的所有版本都兼容,但是在一般情况下来说,如果包有大版本更新变化,很有可能无法兼容当前的内容,所以这种写法不被推荐。

解决方法

把版本号中的 >= 改成 ~ 即可。

~ 表示在大版本范围内往上兼容,但是对大版本不兼容。

比如 ~1.5 可以兼容 1.6,1.7版本,但是不兼容 2.0。

日行一记

@ionepub ionepub added the PHP label Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant