I have a composer.json file that includes the following:
"require": {
"php": "~7.3.0",
"ext-imagick": "*",
"ext-apcu": "*",
"ext-json": "*",
"ext-blackfire": "*",
"doctrine/doctrine-migrations-bundle": "^1.3",
The later use of --ignore-platform-reqs
relates to the docker image not having those extensions, but the Heroku environment does.
The latter is requiring a package, which requires another package.
$ composer why ocramius/package-versions
doctrine/orm v2.7.2 requires ocramius/package-versions (^1.2)
ocramius/proxy-manager 2.8.0 requires ocramius/package-versions (^1.8.0)
$ composer why ocramius/proxy-manager
doctrine/migrations v1.8.1 requires ocramius/proxy-manager (^1.0|^2.0)
This is installing code that uses PHP 7.4's property type declarations. This throws a big ugly error in PHP 7.3.
$ php -d memory_limit=-1 composer.phar update --ignore-platform-reqs
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 195 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.8.0): Loading from cache
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in
/var/www/project/vendor/ocramius/package-versions/src/PackageVersions/Installer.php
on line 33
Why am I always getting this version of ocramius/package-versions
and how to do I prevent this error (and that package version) from happening?