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:
parent
ef49e3984b
commit
bbdd20bfd6
@ -128,6 +128,25 @@ class DocComment
|
|||||||
// is one.
|
// is one.
|
||||||
$docblock = preg_replace('/^\s*\n/', '', $docblock);
|
$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 [
|
return [
|
||||||
'description' => $docblock,
|
'description' => $docblock,
|
||||||
'specials' => $special,
|
'specials' => $special,
|
||||||
|
@ -5,6 +5,8 @@ ini_set('html_errors', '1');
|
|||||||
ini_set('memory_limit', '-1');
|
ini_set('memory_limit', '-1');
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
gc_disable();
|
||||||
|
|
||||||
require __DIR__ . '../../../vendor/autoload.php';
|
require __DIR__ . '../../../vendor/autoload.php';
|
||||||
|
|
||||||
$a = file_get_contents(__DIR__ . '/a.test');
|
$a = file_get_contents(__DIR__ . '/a.test');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user