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

Fix #490 - warm about unknown @psalm- annotations

This commit is contained in:
Matthew Brown 2018-12-01 15:29:14 -05:00
parent ef49e3984b
commit bbdd20bfd6
2 changed files with 21 additions and 0 deletions

View File

@ -128,6 +128,25 @@ class DocComment
// is one.
$docblock = preg_replace('/^\s*\n/', '', $docblock);
foreach ($special as $special_key => $_) {
if (substr($special_key, 0, 6) === 'psalm-') {
$special_key = substr($special_key, 6);
if (!in_array(
$special_key,
[
'return', 'param', 'template', 'var', 'type',
'assert', 'assert-if-true', 'assert-if-false', 'suppress',
'ignore-nullable-return', 'override-property-visibility',
'override-method-visibility', 'seal-properties', 'seal-methods',
'generator-return', 'ignore-falsable-return',
]
)) {
throw new DocblockParseException('Unrecognised annotation @psalm-' . $special_key);
}
}
}
return [
'description' => $docblock,
'specials' => $special,

View File

@ -5,6 +5,8 @@ ini_set('html_errors', '1');
ini_set('memory_limit', '-1');
error_reporting(E_ALL);
gc_disable();
require __DIR__ . '../../../vendor/autoload.php';
$a = file_get_contents(__DIR__ . '/a.test');