Skip to content

Incorrect behavior of ClassPropertyAssignToConstructorPromotionRector with SensitiveParameter attribute #7644

@mbabker

Description

@mbabker

Bug Report

Subject Details
Rector version 0.15.0
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.org/demo/cd6191ec-6e65-4c8c-882f-7e69c3ed6808

<?php

final class ApiClient
{
    private readonly string $apiKey;

    public function __construct(
        #[\SensitiveParameter] string $apiKey,
    ) {
        $this->apiKey = $apiKey;
    }
}

Responsible rules

  • ClassPropertyAssignToConstructorPromotionRector

Expected Behavior

The SensitiveParameter attribute only targets parameters, so constructor arguments with this attribute should not use property promotion.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions