The built-in formatter does not handle PHP 8.4 named arguments correctly when used with a new expression followed by method chaining.
Example:
Expected formatting:
new View(
templatePath: $controller,
serviceContainer: $this->serviceContainer,
)->render();
Actual formatting:
new View(
templatePath: $controller,
serviceContainer: $this->serviceContainer,
)->render();
The parameters are not indented relative to the opening parenthesis.
When using the older syntax with additional parentheses, indentation works correctly:
(new View(
templatePath: $controller,
serviceContainer: $this->serviceContainer,
))->render();
This suggests that the formatter has issues handling indentation for new expressions combined with method chaining and named arguments.
Environment
- PHP version: 8.5
- PHP Tools Version: 1.66.18408
- Code style: PER