mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Add associative-array as an alias of array
This commit is contained in:
parent
bc8952c793
commit
79be178146
@ -262,7 +262,9 @@ abstract class Type
|
||||
|
||||
$generic_type_value = self::fixScalarTerms($generic_type);
|
||||
|
||||
if (($generic_type_value === 'array' || $generic_type_value === 'non-empty-array')
|
||||
if (($generic_type_value === 'array'
|
||||
|| $generic_type_value === 'non-empty-array'
|
||||
|| $generic_type_value === 'associative-array')
|
||||
&& count($generic_params) === 1
|
||||
) {
|
||||
array_unshift($generic_params, new Union([new TArrayKey]));
|
||||
@ -284,7 +286,7 @@ abstract class Type
|
||||
throw new TypeParseTreeException('No generic params provided for type');
|
||||
}
|
||||
|
||||
if ($generic_type_value === 'array') {
|
||||
if ($generic_type_value === 'array' || $generic_type_value === 'associative-array') {
|
||||
return new TArray($generic_params);
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,7 @@ abstract class Atomic
|
||||
return new TCallable();
|
||||
|
||||
case 'array':
|
||||
case 'associative-array':
|
||||
return new TArray([new Union([new TArrayKey]), new Union([new TMixed])]);
|
||||
|
||||
case 'non-empty-array':
|
||||
|
Loading…
Reference in New Issue
Block a user