Skip to content

Incorrect behavior of InlineConstructorDefaultToPropertyRector #9837

Description

@Payn

Bug Report

Subject Details
Rector version 2.6.1

Class constructor is considered always called, even though it may not be when class has child classes. This causes removing property assignments in it as they are considered default, but they are not.

Minimal PHP Code Causing Issue

https://getrector.com/demo/4e21a5a7-0403-4ad5-a445-773bfc9952bd

Expected Behaviour

Class assignments in __construct() shouldn't be moved to property defaults, if constructor is not called from child class as it changes the behavior of code.
But I guess this would be impossible to detect by Rector.

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