Keep in mind; "final" keyword is useless in traits when directly using them, unlike extending classes / abstract classes.
<?php
trait Foo {
final public function hello($s) { print "$s, hello!"; }
}
class Bar {
use Foo;
final public function hello($s) { print "hello, $s!"; }
}
abstract class Foo {
final public function hello($s) { print "$s, hello!"; }
}
class Bar extends Foo {
final public function hello($s) { print "hello, $s!"; }
}
?>
But this way will finalize trait methods as expected;
<?php
trait FooTrait {
final public function hello($s) { print "$s, hello!"; }
}
abstract class Foo {
use FooTrait;
}
class Bar extends Foo {
final public function hello($s) { print "hello, $s!"; }
}
?>