@thomas at somewhere dot com
The 'final' keyword is extremely useful. Inheritance is also useful, but can be abused and becomes problematic in large applications. If you ever come across a finalized class or method that you wish to extend, write a decorator instead.
<?php
final class Foo
{
public method doFoo()
{
// do something useful and return a result
}
}
final class FooDecorator
{
private $foo;
public function __construct(Foo $foo)
{
$this->foo = $foo;
}
public function doFoo()
{
$result = $this->foo->doFoo();
// ... customize result ...
return $result;
}
}
?>