Repository: phpbench/phpbench (php)

Issue:
Attributes with unrecognized annotations will fail
Hey there,

I have a generic benchmark class so that I can test multiple implementations of the same interface at once.
This looks somehow like:

```php
/**
 * @template TOptions of AdapterOptions
 */
#[BeforeMethods('setUp')]
#[AfterMethods('tearDown')]
abstract class AbstractStorageAdapterBenchmark
{}
```

That class is then extended by the concrete implementation benchmark:

```php
/**
 * @template-extends AbstractStorageAdapterBenchmark<RedisClusterOptions>
 */
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisClusterStorageAdapterBench extends AbstractStorageAdapterBenchmark
{}
```

It seems that phpbench does ignore all attributes once a phpdoc on class level is provided.
I assume that this is a bug?

Ref: https://github.com/laminas/laminas-cache-storage-adapter-redis/actions/runs/9620252082/job/26538088931?pr=101
Ref: https://github.com/laminas/laminas-cache-storage-adapter-redis/blob/573ba3b9e1b1f18152230e5216a9c462a22fc57b/benchmark/RedisClusterStorageAdapterBench.php

```
Running ./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate
No entry for terminal type "unknown";
using dumb terminal settings.
PHPBench (1.2.15) running benchmarks... #standwithukraine
with configuration file: /github/workspace/phpbench.json
with PHP version 8.1.27, xdebug ❌, opcache ❌

Warning:  Could not load metadata for file "/github/workspace/benchmark/RedisClusterStorageAdapterBench.php" - is this file intended to be a benchmark? Perhaps setting the `runner.file_pattern` to `*Bench.php` will help: Unrecognized annotation @template, valid PHPBench annotations: @BeforeMethods, @BeforeClassMethods, @AfterMethods, @AfterClassMethods, @ParamProviders, @Groups, @Iterations, @Revs, @Skip, @Sleep, @OutputTimeUnit, @OutputMode, @Warmup, @Subject, @Assert, @Executor, @Timeout, @Format, @RetryThreshold
```

Pull request:
Ignore `@template` and other generic annotations
Fixes #1097 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 319675ce..e77a4a30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@ CHANGELOG
 master
 ------
 
+- Ignore `@template` and other generic annotations #1097 @dantleech
 - Hide noisy log messages for missing fields #1095 @dantleech
 - Defer character reader until command execution @jbboher #1092
 - Import Attribute symbol @gsteel #1075
diff --git a/lib/Benchmark/Metadata/AnnotationReader.php b/lib/Benchmark/Metadata/AnnotationReader.php
index 81b870a7..9a936e13 100644
--- a/lib/Benchmark/Metadata/AnnotationReader.php
+++ b/lib/Benchmark/Metadata/AnnotationReader.php
@@ -113,6 +113,13 @@ class AnnotationReader
         'after' => true,
         'afterClass' => true,
         'backupGlobals' => true,
+        'template' => true,
+        'template-covariant' => true,
+        'template-contravariant' => true,
+        'use' => true,
+        'implements' => true,
+        'extends' => true,
+        'param-out' => true,
         'backupStaticAttributes' => true,
         'before' => true,
         'beforeClass' => true,


Test patch:
diff --git a/tests/Unit/Benchmark/Metadata/Driver/AnnotationDriverTest.php b/tests/Unit/Benchmark/Metadata/Driver/AnnotationDriverTest.php
index 13e08fad..ea0cdc20 100644
--- a/tests/Unit/Benchmark/Metadata/Driver/AnnotationDriverTest.php
+++ b/tests/Unit/Benchmark/Metadata/Driver/AnnotationDriverTest.php
@@ -63,6 +63,12 @@ EOT;
 /**
  * @since Foo
  * @author Daniel Leech
+ * @template TTemplate
+ * @template-covariant TTemplate
+ * @template-contravariant TTemplate
+ * @extends Foobar
+ * @implements Foobar
+ * @use Foobar
  */
 EOT;
         $hierarchy = new ReflectionHierarchy();