Skip to content

Incorrect behavior of AddParamTypeFromPropertyTypeRector #8092

@jlherren

Description

@jlherren

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/40eda128-4418-48ca-8e52-75b0894b43e2

<?php

final class DemoFile
{
    private array $array = [];
    
    /** @param array|null $arrayOrNull */
    public function __construct($arrayOrNull) {
        if ($arrayOrNull !== null) {
            $this->array = $arrayOrNull;
        }
    }
}

Responsible rules

  • AddParamTypeFromPropertyTypeRector

Expected Behavior

No change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions