View on GitHub

RefactoringPHP

A PHP version of the refactors from Refactoring: Improving the Design of Existing Code (Second Edition) by Martin Fowler

Remove Setting Method (331)

Old Code

<?php
class Person
{
    public function getName()
    {
        ...
    }
    
    public function setName()
    {
        ...
    }
}

New Code

<?php
class Person
{
    public function getName()
    {
        ...
    }
}