From bf84ba8e9d486419ec825875014d4773a03f9b14 Mon Sep 17 00:00:00 2001 From: Zois Pagoulatos Date: Tue, 12 May 2026 22:49:05 +0200 Subject: [PATCH] fix: detect PHPUnit #[Test] attribute with fully-qualified name Extends the phpunit-test runnable query to also match methods annotated with a fully-qualified attribute such as: #[\PHPUnit\Framework\Attributes\Test] Previously only the short form `#[Test]` was matched, because the query only handled `(attribute (name))`. For a FQDN attribute the tree-sitter node is a `qualified_name` whose direct `name` child is the class name ("Test"); the namespace segments live inside the nested `prefix` field and are not matched. The fix adds an alternative branch `(qualified_name (name) @_attribute)` alongside the existing `(name) @_attribute` inside the attribute match, so both forms produce the gutter play button. --- languages/php/runnables.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/languages/php/runnables.scm b/languages/php/runnables.scm index 183cf88..170c6c2 100644 --- a/languages/php/runnables.scm +++ b/languages/php/runnables.scm @@ -49,7 +49,7 @@ ; Class that follow the naming convention of PHPUnit test classes ; and that doesn't have the abstract modifier -; and have a method that has the #[Test] attribute +; and have a method that has the #[Test] attribute (short or fully-qualified form) ; and the method is public ( (class_declaration @@ -62,7 +62,12 @@ (method_declaration (attribute_list (attribute_group - (attribute (name) @_attribute) + (attribute + [ + (name) @_attribute + (qualified_name (name) @_attribute) + ] + ) ) ) (#eq? @_attribute "Test")