function AnnotationHelper::getAnnotations
*
Return value
list<Annotation>
28 calls to AnnotationHelper::getAnnotations()
- AnnotationNameSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Commenting/ AnnotationNameSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- DeprecatedAnnotationDeclarationSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Commenting/ DeprecatedAnnotationDeclarationSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- DisallowArrayTypeHintSyntaxSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ TypeHints/ DisallowArrayTypeHintSyntaxSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- DisallowMixedTypeHintSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ TypeHints/ DisallowMixedTypeHintSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- DocCommentSpacingSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Commenting/ DocCommentSpacingSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Helpers/ AnnotationHelper.php, line 43
Class
- AnnotationHelper
- @internal
Namespace
SlevomatCodingStandard\HelpersCode
public static function getAnnotations(File $phpcsFile, int $pointer, ?string $name = null) : array {
$docCommentOpenPointer = DocCommentHelper::findDocCommentOpenPointer($phpcsFile, $pointer);
if ($docCommentOpenPointer === null) {
return [];
}
return SniffLocalCache::getAndSetIfNotCached($phpcsFile, sprintf('annotations-%d-%s', $docCommentOpenPointer, $name ?? 'all'), static function () use ($phpcsFile, $docCommentOpenPointer, $name) : array {
$annotations = [];
if ($name !== null) {
foreach (self::getAnnotations($phpcsFile, $docCommentOpenPointer) as $annotation) {
if ($annotation->getName() === $name) {
$annotations[] = $annotation;
}
}
}
else {
$parsedDocComment = DocCommentHelper::parseDocComment($phpcsFile, $docCommentOpenPointer);
if ($parsedDocComment !== null) {
foreach ($parsedDocComment->getNode()
->getTags() as $node) {
$annotationStartPointer = $parsedDocComment->getNodeStartPointer($phpcsFile, $node);
$annotations[] = new Annotation($node, $annotationStartPointer, $parsedDocComment->getNodeEndPointer($phpcsFile, $node, $annotationStartPointer));
}
}
}
return $annotations;
});
}