grumphp: Fatal error on first composer install
| Q | A |
|---|---|
| Version | 0.14 |
| Bug? | yes |
| New feature? | no |
| Question? | no |
| Documentation? | no |
| Related tickets | comma-separated list of related tickets |
When running composer install in a clean repository (no vendor folder exists yet), I’m getting this error:
Fatal error: Class 'Doctrine\Common\Collections\ArrayCollection' not found in /Users/rasta/DEV/BetterSerializer/vendor/phpro/grumphp/src/Collection/ProcessArgumentsCollection.php on line 8
This happens when running the GrumPHP\\Composer\\DevelopmentIntegrator::integrate composer post install command for the first time.
When running composer install for the second time, the error isn’t there anymore. Which is kind of ok, but this thing breaks my Travis build.
I’m using the composer --no-scripts flag as a workaround for now.
My configuration
parameters:
git_dir: .
bin_dir: vendor/bin
process_timeout: 600
tasks:
phpcs:
standard: PSR2
tab_width: 4
whitelist_patterns: []
encoding: ~
ignore_patterns: []
sniffs: []
triggered_by: [php]
phpcsfixer2:
allow_risky: true
cache_file: .php_cs.cache
config: .php_cs
using_cache: true
config_contains_finder: false
verbose: true
diff: false
triggered_by: [php]
phplint: ~
phpmd:
exclude: []
ruleset: ['dev/phpmd.ruleset.xml']
triggered_by: [php]
phpparser: ~
phpstan:
autoload_file: ~
configuration: dev/phpstan.neon
level: 7
triggered_by: [php]
phpunit: ~
infection:
threads: 2
test_framework: phpunit
only_covered: true
configuration: infection.json
min_msi: ~
min_covered_msi: ~
mutators: []
triggered_by: [php]
phpversion: ~
securitychecker: ~
shell: ~
My composer.json file (minimised to the bare minimum to reproduced the error):
{
"name": "whatever/whatever",
"description": "whatever",
"type": "library",
"license": "MIT",
"minimum-stability": "dev",
"require": {
"php": "^7.2"
},
"require-dev": {
"doctrine/collections": "^1.5",
"phpro/grumphp": "^v0.14"
},
"autoload": {
"psr-4": {
"BetterSerializer\\": "src/BetterSerializer/"
}
},
"autoload-dev": {
"psr-4": {
"BetterSerializer\\": "tests/BetterSerializer/",
"Integration\\": "tests/Integration/"
}
},
"config": {
"platform": {
"php": "7.2"
},
"sort-packages": true
}
}
Steps to reproduce:
# Generate empty folder
git clone https://github.com/better-serializer/better-serializer.git
cd better-serializer
git checkout faster_than_reflection
composer install -o --no-interaction
Result:
Writing lock file
Generating optimized autoload files
Fatal error: Class 'Doctrine\Common\Collections\ArrayCollection' not found in /Users/rasta/DEV/BetterSerializer/vendor/phpro/grumphp/src/Collection/ProcessArgumentsCollection.php on line 8
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (7 by maintainers)
I’ve tested and adding option
"prefer-stable": truetocomposer.jsonavoided this error.This was fixed, but it came back in Composer 1.7.0. It is now fixed again in 1.7.1.
Ref. https://github.com/composer/composer/issues/7516