allow null in union types of VariableCommentSniff
This commit is contained in:
parent
f2fde71ef7
commit
42a7968cee
3 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,7 @@ class VariableCommentSniff extends \PHP_CodeSniffer\Standards\Squiz\Sniffs\Comme
|
||||||
\T_PRIVATE => \T_PRIVATE,
|
\T_PRIVATE => \T_PRIVATE,
|
||||||
\T_PROTECTED => \T_PROTECTED,
|
\T_PROTECTED => \T_PROTECTED,
|
||||||
\T_VAR => \T_VAR,
|
\T_VAR => \T_VAR,
|
||||||
|
\T_NULL => \T_NULL,
|
||||||
\T_STATIC => \T_STATIC,
|
\T_STATIC => \T_STATIC,
|
||||||
\T_TYPE_UNION => \T_TYPE_UNION,
|
\T_TYPE_UNION => \T_TYPE_UNION,
|
||||||
\T_WHITESPACE => \T_WHITESPACE,
|
\T_WHITESPACE => \T_WHITESPACE,
|
||||||
|
|
|
@ -9,6 +9,7 @@ class VariableCommentSniffTest extends TestCase
|
||||||
public function testErrors(): void
|
public function testErrors(): void
|
||||||
{
|
{
|
||||||
$report = self::checkFile(__DIR__ . '/data/comments.php');
|
$report = self::checkFile(__DIR__ . '/data/comments.php');
|
||||||
|
var_dump($report->getErrors());
|
||||||
self::assertCount(1, $report->getWarnings()[20][6]);
|
self::assertCount(1, $report->getWarnings()[20][6]);
|
||||||
self::assertCount(2, $report->getErrors());
|
self::assertCount(2, $report->getErrors());
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class E extends A {
|
||||||
|
|
||||||
class F extends A {
|
class F extends A {
|
||||||
/**
|
/**
|
||||||
* @var A|E
|
* @var A|E|null|bool
|
||||||
*/
|
*/
|
||||||
protected A|E $myVar;
|
protected A|E|null|bool $myVar;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue