Skip to content

Commit

Permalink
phpstan/phpdoc-parser 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Aug 9, 2022
1 parent a2ea28b commit 02f2732
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
14 changes: 11 additions & 3 deletions SlevomatCodingStandard/Helpers/Annotation/AssertAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace SlevomatCodingStandard\Helpers\Annotation;

use InvalidArgumentException;
use PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagMethodValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagPropertyValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use SlevomatCodingStandard\Helpers\AnnotationTypeHelper;
Expand All @@ -15,10 +17,13 @@
class AssertAnnotation extends Annotation
{

/** @var AssertTagValueNode|null */
/** @var AssertTagValueNode|AssertTagPropertyValueNode|AssertTagMethodValueNode|null */
private $contentNode;

public function __construct(string $name, int $startPointer, int $endPointer, ?string $content, ?AssertTagValueNode $contentNode)
/**
* @param AssertTagValueNode|AssertTagPropertyValueNode|AssertTagMethodValueNode|null $contentNode
*/
public function __construct(string $name, int $startPointer, int $endPointer, ?string $content, $contentNode)
{
if (!in_array(
$name,
Expand All @@ -38,7 +43,10 @@ public function isInvalid(): bool
return $this->contentNode === null;
}

public function getContentNode(): AssertTagValueNode
/**
* @return AssertTagMethodValueNode|AssertTagPropertyValueNode|AssertTagValueNode|null
*/
public function getContentNode()
{
$this->errorWhenInvalid();

Expand Down
10 changes: 3 additions & 7 deletions build/PHPStan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ parameters:
count: 1
path: %currentWorkingDirectory%/SlevomatCodingStandard/Sniffs/ControlStructures/AssignmentInConditionSniff.php
-
message: '#Parameter \#5 \$contentNode of class SlevomatCodingStandard\\Helpers\\Annotation\\\w+Annotation constructor expects PHPStan\\PhpDocParser\\Ast\\PhpDoc\\\w+TagValueNode\|null, PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\|null given.#'
count: 13
message: '#Parameter \#5 \$contentNode of class SlevomatCodingStandard\\Helpers\\Annotation\\\w+Annotation constructor expects PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\\\w+(?:\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\\\w+)*\\|null, PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\|null given.#'
count: 14
path: %currentWorkingDirectory%/SlevomatCodingStandard/Helpers/AnnotationHelper.php
-
message: "#^Access to an undefined property PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\AssertTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\MixinTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\ParamTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\PropertyTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\ReturnTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\ThrowsTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\TypeAliasTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\TypelessParamTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\VarTagValueNode\\:\\:\\$type\\.$#"
count: 1
path: %currentWorkingDirectory%/SlevomatCodingStandard/Helpers/AnnotationHelper.php
-
message: "#^Parameter \\#5 \\$contentNode of class SlevomatCodingStandard\\\\Helpers\\\\Annotation\\\\ParameterAnnotation constructor expects PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\ParamTagValueNode\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\TypelessParamTagValueNode\\|null, PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\PhpDocTagValueNode\\|null given\\.$#"
message: "#^Access to an undefined property PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\\\w+(?:\\|PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\\\w+)*\\:\\:\\$type\\.$#"
count: 1
path: %currentWorkingDirectory%/SlevomatCodingStandard/Helpers/AnnotationHelper.php

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": "^7.2 || ^8.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"phpstan/phpdoc-parser": "^1.6.2",
"phpstan/phpdoc-parser": ">=1.7.0 <1.8.0",
"squizlabs/php_codesniffer": "^3.7.1"
},
"require-dev": {
Expand Down

0 comments on commit 02f2732

Please sign in to comment.