Composer.json scripts do not support strings
Closed this issue · 0 comments
adamwillcock commented
After moving from heroku/buildpacks:20
to heroku/builder:22
, composer.json parsing fails when using strings in scripts.
This is noted as valid syntax from Composer: https://getcomposer.org/doc/articles/scripts.md#defining-scripts
An event's scripts can be defined as either a string (only for a single script) or an array (for single or multiple scripts.)
[builder]
[builder] [Error: Failed to parse 'composer.json']
[builder] The parsed contents were invalid.
[builder]
[builder] Details: invalid type: string "phpcbf", expected a sequence at line 100 column 1
[builder]
[builder] Please run 'composer validate' on your local computer for verification.
[builder]
[builder] If you believe this message to be in error, please report it.
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51
Example composer.json:
"compile": [
"bin/doctrine orm:generate-proxies"
],
"cs": [
"phpcs"
],
"cs:fix": "phpcbf",
"test": "phpunit",
"test:ordered": [
"phpunit --testsuite unit",
"phpunit --testsuite functional"
],
"serve": "php -S 0.0.0.0:8080 -t public/"
}
This is resolved when moving the strings into arrays:
"cs:fix": [
"phpcbf"
],