|
3 | 3 | namespace SlevomatCodingStandard\Helpers; |
4 | 4 |
|
5 | 5 | use PHP_CodeSniffer\Files\File; |
| 6 | +use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; |
6 | 7 | use SlevomatCodingStandard\Helpers\Annotation\GenericAnnotation; |
7 | 8 | use SlevomatCodingStandard\Helpers\Annotation\ParameterAnnotation; |
8 | 9 | use SlevomatCodingStandard\Helpers\Annotation\PropertyAnnotation; |
@@ -167,6 +168,21 @@ public function testInlineDocCommentWithParametrizedAnnotation(): void |
167 | 168 | self::assertNull($annotations[0]->getContent()); |
168 | 169 | } |
169 | 170 |
|
| 171 | + public function testWordPressAnnotations(): void |
| 172 | + { |
| 173 | + $annotations = AnnotationHelper::getAnnotations($this->getTestedCodeSnifferFile(), $this->findFunctionPointerByName($this->getTestedCodeSnifferFile(), 'wordPress')); |
| 174 | + |
| 175 | + self::assertCount(1, $annotations); |
| 176 | + self::assertCount(1, $annotations['@param']); |
| 177 | + |
| 178 | + $annotation = $annotations['@param'][0]; |
| 179 | + |
| 180 | + self::assertInstanceOf(ParameterAnnotation::class, $annotation); |
| 181 | + self::assertInstanceOf(IdentifierTypeNode::class, $annotation->getType()); |
| 182 | + self::assertSame('$parameters', $annotation->getParameterName()); |
| 183 | + self::assertSame('{ Optional. Parameters for filtering the list of user assignments. Default empty array. @type bool $is_active Pass `true` to only return active user assignments and `false` to return inactive user assignments. @type DateTime|string $updated_since Only return user assignments that have been updated since the given date and time. }', $annotation->getDescription()); |
| 184 | + } |
| 185 | + |
170 | 186 | public function testFunctionWithoutAnnotation(): void |
171 | 187 | { |
172 | 188 | self::assertCount(0, AnnotationHelper::getAnnotationsByName($this->getTestedCodeSnifferFile(), $this->findFunctionPointerByName($this->getTestedCodeSnifferFile(), 'withoutAnnotation'), '@param')); |
|
0 commit comments