I have two abstract classes in the inheritance chain, within which there will eventually be a shared library:
abstract class Foo {
public function baz() {
echo 'Foo::baz()';
}
}
abstract class Bar extends Foo {
public function baz() {
echo 'Bar::baz()';
}
}
These two classes should be extended by developers, and my problem is that I would like to make sure that none of the methods baz()can be overridden (since they contain strict RFC-compatible code). Creation is Bar::baz() finalnot a problem; however, if I do Foo::baz() final, then myself Bartoo cannot override it.
PHP 5.4 trait, , , PHP < 5.4 . - , , - , .
- , , , DRY (, )?