Skip to content

Commit 446ead7

Browse files
zonuexeondrejmirtes
authored andcommitted
Add missing @phpstan- prefixed tags
1 parent 7bdfdd4 commit 446ead7

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class InvalidPHPStanDocTagRule implements Rule
2323
'@phpstan-param',
2424
'@phpstan-param-out',
2525
'@phpstan-var',
26-
'@phpstan-template',
2726
'@phpstan-extends',
2827
'@phpstan-implements',
2928
'@phpstan-use',
3029
'@phpstan-template',
30+
'@phpstan-template-contravariant',
3131
'@phpstan-template-covariant',
3232
'@phpstan-return',
3333
'@phpstan-throws',
@@ -36,6 +36,7 @@ class InvalidPHPStanDocTagRule implements Rule
3636
'@phpstan-method',
3737
'@phpstan-pure',
3838
'@phpstan-impure',
39+
'@phpstan-immutable',
3940
'@phpstan-type',
4041
'@phpstan-import-type',
4142
'@phpstan-property',
@@ -47,6 +48,9 @@ class InvalidPHPStanDocTagRule implements Rule
4748
'@phpstan-assert-if-false',
4849
'@phpstan-self-out',
4950
'@phpstan-this-out',
51+
'@phpstan-allow-private-mutation',
52+
'@phpstan-readonly',
53+
'@phpstan-readonly-allow-private-mutation',
5054
];
5155

5256
public function __construct(private Lexer $phpDocLexer, private PhpDocParser $phpDocParser)

tests/PHPStan/Rules/PhpDoc/InvalidPHPStanDocTagRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@ public function testRule(): void
3535
]);
3636
}
3737

38+
public function testBug8697(): void
39+
{
40+
$this->analyse([__DIR__ . '/data/bug-8697.php'], []);
41+
}
42+
3843
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php declare(strict_types = 1);
2+
3+
/**
4+
* @phpstan-immutable
5+
* @phpstan-template-contravariant T
6+
*/
7+
class Bug8697
8+
{
9+
10+
/**
11+
* @phpstan-readonly
12+
* @phpstan-allow-private-mutation
13+
* @phpstan-var mixed
14+
*/
15+
public $p1;
16+
17+
/**
18+
* @phpstan-readonly-allow-private-mutation
19+
* @phpstan-var mixed
20+
* @phpstan-throws LogicException
21+
* @phpstan-return void
22+
*/
23+
public $p2;
24+
25+
/**
26+
* @phpstan-param mixed $v
27+
* @phpstan-param-out 1 $v
28+
*/
29+
public function f(&$v)
30+
{
31+
$v = 1;
32+
}
33+
34+
}

0 commit comments

Comments
 (0)