<?php
final class DemoFile
{
public function __construct(
public readonly string $collectionName,
public readonly ?string $partitionName = null,
public readonly ?int $replicaNumber = null,
public readonly ?int $timeout = null,
) {}
public function toRequestPayload(): array
{
$params = [
'partition_name' => $this->partitionName,
'replica_number' => $this->replicaNumber,
'timeout' => $this->timeout,
];
$params = array_filter($params);
return [
'collection_name' => $this->collectionName,
'params' => $params,
];
}
}
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.com/demo/40e04a2c-1611-4a0b-894a-659f31cd612a
Responsible rules
DocblockReturnArrayFromDirectArrayInstanceRectorExpected Behavior
This Rector adds the type
array<string, string|array<string, int|int|string>>int|int|stringpart should beint|stringMaybe it needs some normalization step.