Skip to content

Proposal: enable single_line_empty_body rule #14

Open

Description

Using more and more constructor property promotion with PHP 8.0 now, I more often end up having empty contructor bodies and the current ruleset requires to always have the opening and closing curly braces in new lines.

Might be personal preference which just triggers me a lot, but my suggestion would be to switch on the single_line_empty_body rule to allow for a more compact way of writing this

Empty body of class, interface, trait, enum or function must be abbreviated as {} and placed on the same line as the previous symbol, separated by a single space.

https://cs.symfony.com/doc/rules/basic/single_line_empty_body.html

Before

class MyService {
	public function __construct(
		private IURLGenerator $urlGenerator,
	) {
	}
}

After

class MyService {
	public function __construct(
		private IURLGenerator $urlGenerator,
	) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions