1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix #453 - catch bad objectlike type when analysing docblock

This commit is contained in:
Matt Brown 2018-01-19 16:06:30 -05:00
parent 6ce4aa19e4
commit 9f2a0847a4
2 changed files with 12 additions and 0 deletions

View File

@ -215,6 +215,10 @@ abstract class Type
throw new \InvalidArgumentException('Object-like type must be array'); throw new \InvalidArgumentException('Object-like type must be array');
} }
if (!$properties) {
throw new \InvalidArgumentException('No properties supplied for ObjectLike');
}
return new ObjectLike($properties); return new ObjectLike($properties);
} }

View File

@ -729,6 +729,14 @@ class AnnotationTest extends TestCase
}', }',
'error_message' => 'UndefinedClass', 'error_message' => 'UndefinedClass',
], ],
'preventBadObjectLikeFormat' => [
'<?php
/**
* @param array{} $arr
*/
function bar(array $arr): void {}',
'error_message' => 'InvalidDocblock',
]
]; ];
} }
} }