mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #453 - catch bad objectlike type when analysing docblock
This commit is contained in:
parent
6ce4aa19e4
commit
9f2a0847a4
@ -215,6 +215,10 @@ abstract class Type
|
||||
throw new \InvalidArgumentException('Object-like type must be array');
|
||||
}
|
||||
|
||||
if (!$properties) {
|
||||
throw new \InvalidArgumentException('No properties supplied for ObjectLike');
|
||||
}
|
||||
|
||||
return new ObjectLike($properties);
|
||||
}
|
||||
|
||||
|
@ -729,6 +729,14 @@ class AnnotationTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'UndefinedClass',
|
||||
],
|
||||
'preventBadObjectLikeFormat' => [
|
||||
'<?php
|
||||
/**
|
||||
* @param array{} $arr
|
||||
*/
|
||||
function bar(array $arr): void {}',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user