Skip to content

RemoveSetterOnlyPropertyAndMethodCallRector removes methods required by interface #2777

@escopecz

Description

@escopecz
Subject Details
Rector version v0.6.13
PHP version PHP 7.2
Full Command vendor/bin/rector process /src
Demo link https://getrector.org/demo/88129a64-f23e-430a-a8d4-fe282d39553d
rector.yaml See the demo

Current Behaviour

See the demo. The method it removes must remain as it's required by the interface.

Minimal PHP Code Causing Issue

<?php

interface DemoInterface
{
	public function demoMethod($demoVar);
}

class DemoClass implements DemoInterface
{
    private $demoVar;
	
	public function demoMethod($demoVar)
	{
		$this->demoVar = $demoVar;
	}
}

Expected Behaviour

It should remove only the useless variable. Not the required method. It should leave it empty.

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