I am coding in PHP with PhpStorm 2022.3 and the plugin SonarLint 7.2.1.58118 on macOS 12.6.1. The plugin is connected to an active subscription of SonarCloud. I am not sure which version is running on SonarCloud, but I assume the cloud version always runs the last one.
The indentation check gives wrong suggestions on PHP file indented with tabs. It counts tabs that are in the actual file as 1 column, but it counts tabs that need to be added as 4 columns.
I have attached a simple PHP file to demonstrate the problem.
<?php
class Test
{
public function __construct(
string $string = 'test',
int $int = 42,
bool $bool = true
)
{
var_dump(
$string,
'foo',
'bar',
);
if ($bool) {
var_dump(
$int,
'bar',
'foo',
);
}
}
}
I get the following 3 issues:
- (6, 2) Align all arguments in this list at column “5”.
- (12, 3) Align all arguments in this list at column “6”.
- (20, 4) Align all arguments in this list at column “7”.
All those values are 3 too high, the lines should actually be aligned on columns 2, 3 and 4, as they are in the file. So I expected not getting those 3 issues at all.
I think this error is caused by the following Java file, which belongs to rule php:S1808
. The indentation should be 4 for files separated by spaces, but 1 for files separated by tabs. Or, at the place where tabs are counted, a tab should be counted as 4, instead of 1.