Skip to content

[php2cpg] fix annotation name and fullName - #6222

Merged
TNSelahle merged 2 commits into
masterfrom
tebogo/php-annotation-names
Aug 26, 2026
Merged

TNSelahle merged 2 commits into
masterfrom
tebogo/php-annotation-names

Conversation

@TNSelahle

@TNSelahle TNSelahle commented Aug 26, 2026

Copy link
Copy Markdown
Member
  • Fix the name and fullName properties of annotations

fixes https://harness.atlassian.net/browse/QT-921

Annotation(
    argumentIndex = -1,
    argumentLabel = None,
    argumentName = None,
    code = """PhpMcp\Server\Attributes\McpTool""",
    columnNumber = None,
    depthFirstOrder = -1,
    fullName = """PhpMcp\Server\Attributes\McpTool""",
    internalFlags = 0,
    lineNumber = Some(value = 26),
    name = "McpTool",
    offset = None,
    offsetEnd = None,
    order = 8
  )

@TNSelahle
TNSelahle requested review from maltek and ml86 August 26, 2026 09:26
val name = attribute.name
val fullName = composeMethodFullName(name.name)
val fullName = attribute.name.name
val name = fullName.split("\\\\").last

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the character split to avoid a regex here (I wish there was a builtin takeRightWhile to avoid the array allocation as well):

Suggested change
val name = fullName.split("\\\\").last
val name = fullName.split('\\').last

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TNSelahle
TNSelahle merged commit 529f827 into master Aug 26, 2026
8 checks passed
@TNSelahle
TNSelahle deleted the tebogo/php-annotation-names branch August 26, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants