Reader throws exception on "packagist:false" repository
SvenRtbg opened this issue · comments
Using the 2.0.0 release:
This composer.json is valid according to Composer:
{
"name": "foo/bar",
"description": "Descriptive text",
"license": "CC0-1.0",
"authors": [
{
"name": "Chuck Norris",
"email": "chuck@example.com"
}
],
"repositories": [
{
"packagist": false
}
]
}
However, this code throws an exception:
$reader = new Eloquent\Composer\Configuration\ConfigurationReader;
$configuration = $reader->read($composerJson);
In ConfigurationReader line 286, this happens:
$type = $repository->get('type');
The repository that disables Packagist access does not have a type property, the access results in an exception.
I don't really have an expectation of what I should get back, probably a dedicated "PackagistIsDisabled" repository object would be in order. I'd even go as far as ignoring this special repo here and transmit a flag elswhere. The exception however shouldn't happen, for obvious reasons. :)
Thanks for the report. I'll try to have a fix out soon. I think perhaps I'll implement it such that a repository object representing the Packagist repository is implicitly added unless packagist: false
is specified.
Wow, sorry this got left for so long. If it's at all still relevant to you, in the next release, this will be represented by a PackagistRepository
with an isEnabled()
method that will return false.