Closed
Description
I'm trying to check this file:
<?php
declare(strict_types=1);
namespace Test;
class SomeClass
{
protected function transformRow(array $row)
{
return [
'key1' => 'value1',
'key2' => (int) $row['value2'],
'status_verify' => $row['status'] === 'rejected'
? self::REJECTED_CODE
: self::VERIFIED_CODE,
'user_verification_status' => in_array($row['status'], ['notverified', 'unverified'], true)
? self::STATUS_PENDING
: self::STATUS_VERIFIED,
'created_at' => strtotime($row['date']),
];
}
}
With this command:
docker run --rm -v $(pwd):/scripts/ texthtml/phpcs:3.3.0 phpcs --standard=/scripts/phpcs.xml -n -p -s /scripts/test.php
And I'm getting these unexpected errors:
13 | ERROR | [x] Each line in an array declaration must end in a
| | comma (Squiz.Arrays.ArrayDeclaration.NoComma)
16 | ERROR | [x] Each line in an array declaration must end in a
| | comma (Squiz.Arrays.ArrayDeclaration.NoComma)
Interesting, that if I replace status_verify
with key3
f.e., the error on the line 13 will disappear. And if I replace user_verification_status
with key4
f.e., the all errors will disappear 🤔