mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-04 22:17:25 +02:00
Final public method for abstract class
All public methods of abstract classes should be final. Enforce API encapsulation in an inheritance architecture. If you want to override a method, use the Template method pattern.
This commit is contained in:
@@ -8,7 +8,7 @@ abstract class Colleague
|
||||
{
|
||||
protected Mediator $mediator;
|
||||
|
||||
public function setMediator(Mediator $mediator)
|
||||
final public function setMediator(Mediator $mediator)
|
||||
{
|
||||
$this->mediator = $mediator;
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ abstract class Journey
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getThingsToDo(): array
|
||||
final public function getThingsToDo(): array
|
||||
{
|
||||
return $this->thingsToDo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user