mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Support @psalm-readonly too
This commit is contained in:
parent
662f094886
commit
78175c9765
@ -151,7 +151,7 @@ class DocComment
|
||||
'generator-return', 'ignore-falsable-return', 'variadic', 'pure',
|
||||
'ignore-variable-method', 'ignore-variable-property', 'internal',
|
||||
'taint-sink', 'taint-source', 'assert-untainted', 'scope-this',
|
||||
'mutation-free', 'external-mutation-free', 'immutable',
|
||||
'mutation-free', 'external-mutation-free', 'immutable', 'readonly',
|
||||
],
|
||||
true
|
||||
)) {
|
||||
@ -274,7 +274,7 @@ class DocComment
|
||||
'generator-return', 'ignore-falsable-return', 'variadic', 'pure',
|
||||
'ignore-variable-method', 'ignore-variable-property', 'internal',
|
||||
'taint-sink', 'taint-source', 'assert-untainted', 'scope-this',
|
||||
'mutation-free', 'external-mutation-free', 'immutable',
|
||||
'mutation-free', 'external-mutation-free', 'immutable', 'readonly',
|
||||
],
|
||||
true
|
||||
)) {
|
||||
|
@ -179,7 +179,8 @@ class CommentAnalyzer
|
||||
$var_comment->type_end = $type_end;
|
||||
$var_comment->deprecated = isset($parsed_docblock['specials']['deprecated']);
|
||||
$var_comment->internal = isset($parsed_docblock['specials']['internal']);
|
||||
$var_comment->readonly = isset($parsed_docblock['specials']['readonly']);
|
||||
$var_comment->readonly = isset($parsed_docblock['specials']['readonly'])
|
||||
|| isset($parsed_docblock['specials']['psalm-readonly']);
|
||||
if (isset($parsed_docblock['specials']['psalm-internal'])) {
|
||||
$psalm_internal = reset($parsed_docblock['specials']['psalm-internal']);
|
||||
if ($psalm_internal) {
|
||||
@ -201,12 +202,14 @@ class CommentAnalyzer
|
||||
if (!$var_comments
|
||||
&& (isset($parsed_docblock['specials']['deprecated'])
|
||||
|| isset($parsed_docblock['specials']['internal'])
|
||||
|| isset($parsed_docblock['specials']['readonly']))
|
||||
|| isset($parsed_docblock['specials']['readonly'])
|
||||
|| isset($parsed_docblock['specials']['psalm-readonly']))
|
||||
) {
|
||||
$var_comment = new VarDocblockComment();
|
||||
$var_comment->deprecated = isset($parsed_docblock['specials']['deprecated']);
|
||||
$var_comment->internal = isset($parsed_docblock['specials']['internal']);
|
||||
$var_comment->readonly = isset($parsed_docblock['specials']['readonly']);
|
||||
$var_comment->readonly = isset($parsed_docblock['specials']['readonly'])
|
||||
|| isset($parsed_docblock['specials']['psalm-readonly']);
|
||||
|
||||
$var_comments[] = $var_comment;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user