-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
The recent type additions appear somewhat questionable in several places. Many aspects are concerning. For instance, we're running Psalm at error level 1 (with one exception - MixedAssignment) - while 2.0.52 shows no errors, 2.0.53 suddenly reports 197 new errors! Given that Psalm serves as our CI quality gate, these typing changes effectively break backward compatibility.
Yii 2.0.53
* @psalm-type RegisterJsFileOptions = array{
* depends?: class-string[],
* position?: int,
* appendTimestamp?: boolean
* }Code
$this->jsOptions = [
'type' => 'module',
'crossorigin' => true,
];Psalm error level 1:
ERROR: InvalidPropertyAssignmentValue - $this->jsOptions with declared type 'array{appendTimestamp?: bool, depends?: array<array-key, class-string>, position?: int}' cannot be assigned type 'array{crossorigin: true, type: 'module'}' (see https://psalm.dev/145)
We should either be more cautious with such additions or at minimum document them properly in UPGRADE.md