File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
rules-tests/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector/Fixture
rules/AnnotationsToAttributes/Rector/Class_ Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use PHPUnit\Framework\TestCase;
66
77/**
88 * @covers \Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector\Source\ExistingClass
9+ * @covers \Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector\Source\AnotherExistingClass::someMethod
910 */
1011final class CoversClass extends TestCase
1112{
@@ -23,6 +24,7 @@ namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\Class_\CoversAnnot
2324use PHPUnit \Framework \TestCase ;
2425
2526#[\PHPUnit \Framework \Attributes \CoversClass(\Rector \PHPUnit \Tests \AnnotationsToAttributes \Rector \Class_ \CoversAnnotationWithValueToAttributeRector \Source \ExistingClass::class)]
27+ #[\PHPUnit \Framework \Attributes \CoversClass(\Rector \PHPUnit \Tests \AnnotationsToAttributes \Rector \Class_ \CoversAnnotationWithValueToAttributeRector \Source \AnotherExistingClass::class)]
2628final class CoversClass extends TestCase
2729{
2830 public function test ()
Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ final class CoversMethod extends TestCase
1212 public function test ()
1313 {
1414 }
15+
16+ /**
17+ * @covers \Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector\Source\AnotherExistingClass::someMethod
18+ */
19+ public function test_foo ()
20+ {
21+ }
1522}
1623
1724?>
@@ -23,11 +30,16 @@ namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\Class_\CoversAnnot
2330use PHPUnit \Framework \TestCase ;
2431
2532#[\PHPUnit \Framework \Attributes \CoversClass(\Rector \PHPUnit \Tests \AnnotationsToAttributes \Rector \Class_ \CoversAnnotationWithValueToAttributeRector \Source \ExistingClass::class)]
33+ #[\PHPUnit \Framework \Attributes \CoversClass(\Rector \PHPUnit \Tests \AnnotationsToAttributes \Rector \Class_ \CoversAnnotationWithValueToAttributeRector \Source \AnotherExistingClass::class)]
2634final class CoversMethod extends TestCase
2735{
2836 public function test ()
2937 {
3038 }
39+
40+ public function test_foo ()
41+ {
42+ }
3143}
3244
3345?>
Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ private function createAttributeGroup(string $annotationValue): AttributeGroup
140140 if (str_starts_with ($ annotationValue , ':: ' )) {
141141 $ attributeClass = self ::COVERS_FUNCTION_ATTRIBUTE ;
142142 $ attributeValue = trim ($ annotationValue , ':() ' );
143+ } elseif (str_contains ($ annotationValue , ':: ' )) {
144+ $ attributeClass = self ::COVERTS_CLASS_ATTRIBUTE ;
145+ $ attributeValue = $ this ->getClass ($ annotationValue ) . '::class ' ;
143146 } else {
144147 $ attributeClass = self ::COVERTS_CLASS_ATTRIBUTE ;
145148 $ attributeValue = trim ($ annotationValue ) . '::class ' ;
You can’t perform that action at this time.
0 commit comments