Problem/Motivation
Currently, all core service definitions put their arguments on one long line:
arguments: ['@something', '@something.else', '@another_one', '@getting_long', '@cheaper', '@by.the.dozen']
In reviewing #3041885: Display relevant Security Advisories data for Drupal, @larowlan pointed out that sometimes, with services that have many dependencies, these lines are harder to read, and might be better if we used the list format:
arguments:
- '@something'
- '@something.else'
- '@another_one'
- '@getting_long'
- '@cheaper'
- '@by.the.dozen'
At his suggestion, I'm opening this issue to decide when, if ever, service arguments should span multiple lines, instead of one long line.
Benefits
Increased readability and reduces the need for side scrolling.
Three supporters required
- https://www.drupal.org/u/borisson_ (2025-08-22)
- https://www.drupal.org/u/{userid} (yyyy-mm-dd they added support)
- https://www.drupal.org/u/{userid} (yyyy-mm-dd they added support)
Proposed changes
Current text
Proposed text
Notes
Remaining tasks
Create this issue in the Coding Standards queue, using the defined template- Add supporters
- Create a Change Record
- Review by the Coding Standards Committee
- Coding Standards Committee takes action as required
- Discussed by the Core Committer Committee, if it impacts Drupal Core
- Final review by Coding Standards Committee
- Documentation updates
- Edit all pages
- Publish change record
- Remove 'Needs documentation edits' tag
- If applicable, create follow-up issues for PHPCS rules/sniffs changes
For a full explanation of these steps see the Coding Standards project page
upstream work on a sniff, https://github.com/slevomat/coding-standard/issues/1684
Comments
Comment #2
phenaproximaFor whatever my opinion is worth on this: I always use the extended multi-line format in my own projects, as I find it more readable in all cases, and it eliminates the possibility of horizontal scrolling. But that's just me.
Comment #3
larowlanSame, even when it doesn't wrap
Also, yellow
Comment #4
longwaveWe don't seem to have any explicit standards for YAML files but https://www.drupal.org/docs/develop/standards/coding-standards#linelength is a good place to start.
Not sure if we can enforce this standard using any existing tools, maybe Coder could be extended to handle this though.
Comment #9
quietone commentedMoving to the coding standards project in the hopes of some discussion.
Comment #10
quietone commentedThis needs the coding standards template
Comment #11
borisson_I agree, I also prefer to always use the extended format.
Added template