-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
Description
Hi, I've got these messages:
[BC] CHANGED: Default parameter value for parameter $nextAutoIndex of PHPStan\Type\Constant\ConstantArrayType#__construct() changed from 0 to array (
0 => 0,
)
[BC] CHANGED: The parameter $nextAutoIndex of PHPStan\Type\Constant\ConstantArrayType#__construct() changed from int to a non-contravariant int|array
[BC] CHANGED: The parameter $nextAutoIndex of PHPStan\Type\Constant\ConstantArrayType#__construct() changed from int to int|array
This is how the PHP diff looks like:
/**
* @api
* @param array<int, ConstantIntegerType|ConstantStringType> $keyTypes
* @param array<int, Type> $valueTypes
+ * @param non-empty-list<int>|int $nextAutoIndexes
* @param int[] $optionalKeys
*/
public function __construct(
private array $keyTypes,
private array $valueTypes,
- private int $nextAutoIndex = 0,
+ int|array $nextAutoIndexes = [0],
private array $optionalKeys = [],
)
{
assert(count($keyTypes) === count($valueTypes));
+ if (is_int($nextAutoIndexes)) {
+ $nextAutoIndexes = [$nextAutoIndexes];
+ }
+
+ $this->nextAutoIndexes = $nextAutoIndexes;
+
I'm widening the type of the parameter, and if the argument is omitted from the call, or if the old type is passed to the parameter, the result is the same.
I don't see how this is a BC break, but I'm open to be corrected :) Thanks.