openeuropa / drupal-module-template

European Union Public License 1.2
10 stars 6 forks source link

List of repositories in composer manifest should be an array #15

Closed pfrenssen closed 5 years ago

pfrenssen commented 6 years ago

When I try to add another repository to the composer manifest using the instructions at the official Composer documentation (ref. composer.json schema: repositories) then I get the following error:

[Seld\JsonLint\ParsingException]               
  "./composer.json" does not contain valid JSON  
  Parse error on line 21:                        
  ...itories": {        {            "type"      
  ---------------------^                         
  Expected one of: 'STRING', '}

It appears that we have declared this parameter as a JSON object but the documentation strongly suggests to use an array so that the correct order of the repositories can be guaranteed when resolving the dependencies.

Order is significant here. When looking for a package, Composer will look from the first to the last repository, and pick the first match. By default Packagist is added last which means that custom repositories can override packages from it. Using JSON object notation is also possible. However, JSON key/value pairs are to be considered unordered so consistent behaviour cannot be guaranteed.

drupol commented 5 years ago

I think the issue is spread all accross the components. We should fix them all I think.

imanoleguskiza commented 5 years ago

As @drupol suggested I opened this: https://webgate.ec.europa.eu/CITnet/jira/browse/OPENEUROPA-1572

drupol commented 5 years ago

I think a new grumphp task could be added in openeuropa/code-review: https://github.com/phpro/grumphp/blob/master/doc/tasks/composer.md