php - Why can't I require a specific commit from "dev-master" for this package?
Get the solution ↓↓↓I'm trying to install apigen/apigen via Composer (specifically,dev-master
). The latest commit requires roave/better-reflection at a certain commit. I ran into issues where Composer was unable to find that particular reference (#c87d856).
To reproduce the issue, I created a minimalcomposer.json
file that requires only that missing package/version:
{
"name": "a-vendor/some-library",
"type": "library",
"repositories": [
{
"type": "package",
"package": {
"name": "roave/better-reflection",
"version": "dev-master#c87d856",
"source": {
"type": "git",
"url": "https://github.com/roave/BetterReflection.git",
"reference": "commit/c87d856"
}
}
}
],
"require-dev": {
"roave/better-reflection": "dev-master#c87d856"
}
}
I was hoping that adding that repository as a package might work around the issue. I thought the difference between the repo and package name might be the problem). However, I get the same issue, with the message:
The requested package roave/better-reflection dev-master#c87d856 exists as roave/better-reflection[0.1.0, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 2.0.0, 2.0.1, 2.0.2, 3.0.0, 3.1.0, 3.1.1, 3.2.0, 3.3.0, 3.4.0, 3.5.0, 4.0.0, 4.1.0, 4.10.0, 4.10.x-dev, 4.11.0, 4.11.x-dev, 4.12.x-dev, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.6.1, 4.7.0, 4.8.0, 4.8.x-dev, 4.9.0, 4.9.x-dev, dev-dependabot/composer/doctrine/coding-standard-8.2.0, dev-dependabot/composer/infection/infection-0.17.5, dev-dependabot/composer/phpstan/phpstan-0.12.48, dev-dependabot/composer/phpstan/phpstan-0.12.52, dev-dependabot/composer/phpstan/phpstan-0.12.53, dev-dependabot/composer/vimeo/psalm-3.16, dev-dependabot/composer/vimeo/psalm-3.18.2, dev-implement-newInstanceArgs, dev-master#c87d856] but these are rejected by your constraint.
You can see that the repository that I added is there at the end of the list, but Composer doesn't pick it up as a match.
Does anyone have any ideas about how I can help Composer locate this version/commit, and have that work for the dependency (apigen/apigen) that requires it?
Answer
Solution:
$ composer req --dev roave/better-reflection:4.12.x-dev#c87d856
There is nomaster
branch for that repo, and it seems that the branch4.12.x
has been aliased to4.12.x-dev
(packagist).
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: trying to access array offset on value of type null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.