Skip to content

Commit

Permalink
make PhpDocInfo::findByAnnotationClass() public to use in Symfony rules
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 1, 2023
1 parent 15bc115 commit 4188212
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function getByAnnotationClass(string $class): ?DoctrineAnnotationTagValue
}

/**
* @api used in tests
* @api used in tests, doctrine
*/
public function hasByAnnotationClass(string $class): bool
{
Expand Down Expand Up @@ -456,6 +456,15 @@ public function getConstFetchNodeClassNames(): array
return $classNames;
}

/**
* @param class-string $desiredClass
* @return DoctrineAnnotationTagValueNode[]
*/
public function findByAnnotationClass(string $desiredClass): array
{
return $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass($this->phpDocNode, $desiredClass);
}

private function resolveNameForPhpDocTagValueNode(PhpDocTagValueNode $phpDocTagValueNode): ?string
{
foreach (self::TAGS_TYPES_TO_NAMES as $tagValueNodeType => $name) {
Expand All @@ -468,15 +477,6 @@ private function resolveNameForPhpDocTagValueNode(PhpDocTagValueNode $phpDocTagV
return null;
}

/**
* @param class-string $desiredClass
* @return DoctrineAnnotationTagValueNode[]
*/
private function findByAnnotationClass(string $desiredClass): array
{
return $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass($this->phpDocNode, $desiredClass);
}

private function getTypeOrMixed(?PhpDocTagValueNode $phpDocTagValueNode): MixedType | Type
{
if (! $phpDocTagValueNode instanceof PhpDocTagValueNode) {
Expand Down

0 comments on commit 4188212

Please sign in to comment.