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:
parent
6ce4aa19e4
commit
9f2a0847a4
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user