Closed AegirLeet closed 3 years ago
Running the Composer task results in a crash if no_local_repository: true is set and the configuration described here is used to disable packagist.org.
no_local_repository: true
https://github.com/phpro/grumphp/blob/5311bdf2166958094cf69ada9db0e4f77f83fd7b/src/Task/Composer.php#L108 assumes $repository['type'] is set, which is not guaranteed to be the case.
$repository['type']
My configuration
# grumphp.yml grumphp: tasks: composer: no_local_repository: true
Steps to reproduce:
Set up a new project:
mkdir tmp cd tmp git init echo "vendor" > .gitignore pbpaste > grumphp.yml
Add the following to composer.json:
{ "name": "foo/bar", "description": "foo", "type": "project", "license": "proprietary", "minimum-stability": "stable", "require-dev": { "phpro/grumphp": "^1.3" } }
Install GrumPHP:
composer u
Then change composer.json to this:
{ "name": "foo/bar", "description": "foo", "type": "project", "license": "proprietary", "minimum-stability": "stable", "require-dev": { "phpro/grumphp": "^1.3" }, "repositories": [ { "packagist.org": false } ] }
Finally, remove composer.lock (because it's outdated), stage composer.json and run GrumPHP:
rm composer.lock git add composer.json ./vendor/bin/grumphp run
Result:
Notice: Undefined index: type in ./vendor/phpro/grumphp/src/Task/Composer.php on line 108
Running the Composer task results in a crash if
no_local_repository: true
is set and the configuration described here is used to disable packagist.org.https://github.com/phpro/grumphp/blob/5311bdf2166958094cf69ada9db0e4f77f83fd7b/src/Task/Composer.php#L108 assumes
$repository['type']
is set, which is not guaranteed to be the case.My configuration
Steps to reproduce:
Set up a new project:
Add the following to composer.json:
Install GrumPHP:
Then change composer.json to this:
Finally, remove composer.lock (because it's outdated), stage composer.json and run GrumPHP:
Result: