-
-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Php80] Handle AnnotationToAttributeRector + ClassPropertyAssignToConstructorPromotionRector #1712
[Php80] Handle AnnotationToAttributeRector + ClassPropertyAssignToConstructorPromotionRector #1712
Conversation
…structorPromotionRector
9766da2
to
cd915a2
Compare
Fixed 🎉 |
It seems cause error in test for 1) Rector\Tests\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector\ClassPropertyAssignToConstructorPromotionRectorTest::test with data set #6 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
rules-tests/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector/Fixture/typed_with_var_type.php.inc
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
class TypeWithVarType
{
- public function __construct(private SomeTypedPropertyClass $someTypedPropertyClass)
+ public function __construct(
+ /**
+ * @var SomeTypedPropertyClass
+ */
+ private SomeTypedPropertyClass $someTypedPropertyClass
+ ) |
Fixed 🎉 |
57b08ef
to
8ca8b98
Compare
All checks have passed 🎉 @TomasVotruba it is ready for review. |
👍 |
Thank you, @samsonasik |
this desn't seem to work i'm afraid. i'm using only <?php
declare(strict_types=1);
use Symfony\Component\Serializer\Annotation\SerializedName;
class Address
{
/**
* @var string[]
* @SerializedName("owsy/derived-facts")
*/
private array $derivedFacts;
public function __construct(
array $derivedFacts = [],
) {
$this->derivedFacts = $derivedFacts;
}
} becomes: <?php
declare(strict_types=1);
use Symfony\Component\Serializer\Annotation\SerializedName;
class Address
{
public function __construct(
private array $derivedFacts = []
)
{
}
} |
@bendavies I can't reproduce, ref https://getrector.org/demo/1ec880a6-0fbe-6808-aca7-534e7c93c383 Please provide failing test case for it, thanks. |
@samsonasik apologies, the issue is when used with |
@samsonasik also, in your example the |
@bendavies on that case, |
thankyou! |
Given the following code:
It currently produce:
which the annotation should not removed. Applied rules:
This PR try to fixes it.
Closes #1702
Fixes rectorphp/rector#6949