Incorrect behavior of AnnotationWithValueToAttributeRector, CoversAnnotationWithValueToAttributeRector
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/313b144d-037f-4b7e-95b6-709f181d40cc
<?php
/*
* This file is part of the Alice package.
*
* (c) Nelmio <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Nelmio\Alice\Generator\Resolver;
use Nelmio\Alice\Definition\Value\UniqueValue;
use Nelmio\Alice\Entity\StdClassFactory;
use PHPUnit\Framework\TestCase;
use stdClass;
/**
* @covers \Nelmio\Alice\Generator\Resolver\UniqueValuesPool
* @internal
*/
final class UniqueValuesPoolTest extends TestCase
{
/**
* @depends \Nelmio\Alice\Definition\Value\UniqueValueTest::testIsImmutable
*/
public function testIsImmutable(): void
{
self::assertTrue(true, 'Nothing to do.');
}
}
Responsible rules
-
AnnotationWithValueToAttributeRector -
CoversAnnotationWithValueToAttributeRector
Expected Behavior
The @depends here should be transformed into #[DependsExternal]:
- /**
- * @depends \Nelmio\Alice\Definition\Value\UniqueValueTest::testIsImmutable
- */
+ #[\PHPUnit\Framework\Attributes\DependsExternal(\Nelmio\Alice\Definition\Value\UniqueValueTest::class, 'testIsImmutable')]
Currently rector gives:
- /**
- * @depends \Nelmio\Alice\Definition\Value\UniqueValueTest::testIsImmutable
- */
+ #[\PHPUnit\Framework\Attributes\Depends(\Nelmio\Alice\Definition\Value\UniqueValueTest::testIsImmutable)]
Which is incorrect.
Seems legic. Care to send PR?
Sorry I have to focus on getting about ~20 packages to PHP 8.5/Symfony8 before I get a chance to look at that :/
That's a day of running Rector work ;)
Of course, no worries.
That's a day of running Rector work ;)
I wouldn't have started that work without rector 😅 Too much code for Claude still either, I think I'd have archived half of them if it wasn't for Rector.
That sounds like a great job! 🚀 👏
20 project is good enough sample. If you find a tip for new rules we could automate with Rector, drop me a tip. We'll look into it 😉