4 public $nonStaticInheritedProp;
6 public function nonStaticInheritedMethod() {
7 echo __METHOD__
, ' of ', static::class, "\n";
8 echo 'this: ', isset($this) ?
'defined' : 'undefined', "\n";
15 public $nonStaticTraitProp;
17 public function nonStaticTraitMethod() {
18 echo __METHOD__
, ' of ', static::class, "\n";
19 echo 'this: ', isset($this) ?
'defined' : 'undefined', "\n";
21 public static function staticTraitMethod() {
23 echo __METHOD__
, "\n";
26 abstract public function nonStaticAbstract();
29 abstract final class Utils
extends C
{
32 public static function staticMethod() {
33 echo __METHOD__
, "\n";
34 static::protStaticMethod();
37 private static function privStaticMethod() {
38 echo __METHOD__
, ' ', self
::$prop, "\n";
41 protected static function protStaticMethod() {
42 echo __METHOD__
, "\n";
43 self
::privStaticMethod();
46 private static $prop = __CLASS__
.'::prop';
50 Utils
::staticMethod();
51 Utils
::staticTraitMethod();
52 Utils
::nonStaticInheritedMethod(); // works because $this isn't accessed
53 Utils
::nonStaticTraitMethod(); // works because $this isn't accessed
55 $rc = new ReflectionClass(Utils
::class);
56 echo 'ReflectionClass::isAbstract', ' => ';
57 var_dump($rc->isAbstract());
58 echo 'ReflectionClass::isFinal', ' => ';
59 var_dump($rc->isFinal());
60 echo 'ReflectionClass::isInstantiable', ' => ';
61 var_dump($rc->isInstantiable());