mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 06:57: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:
@@ -11,12 +11,12 @@ abstract class BookPrototype
|
||||
|
||||
abstract public function __clone();
|
||||
|
||||
public function getTitle(): string
|
||||
final public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(string $title): void
|
||||
final public function setTitle(string $title): void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
Reference in New Issue
Block a user