<?php
namespace Ref;
trait T
{
public $traitProperty;
public function traitMethod() {}
}
interface I
{
const I = 'I';
public function i();
}
abstract class A implements I
{
use T {
T::traitMethod as tMethod;
}
const A = 'A';
public function __construct() {}
public function a() {}
}
abstract class B extends A
{
const B = 'B';
public $public = 'public';
protected static $publicStatic;
}
class C extends B
{
public function __construct(\ReflectionClass $a)
{
}
public function i() {}
}
$r = new \ReflectionClass('Ref\C');
//$r->getProperty('publicStatic')->setAccessible(true);
var_dump($r->hasMethod('tMethod'));
var_dump($r->hasMethod('traitMethod'));
var_dump($r->hasMethod('a'));
var_dump($r->isSubclassOf('Ref\I'));
$r->newInstance();
bool(true)
bool(true)
bool(true)
bool(true)
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Ref\C::__construct(), 0 passed and exactly 1 expected in /in/2pmPY:43
Stack trace:
#0 [internal function]: Ref\C->__construct()
#1 /in/2pmPY(57): ReflectionClass->newInstance()
#2 {main}
thrown in /in/2pmPY on line 43
Process exited with code 255.
Output for 7.0.0 - 7.0.33
bool(true)
bool(true)
bool(true)
bool(true)
Fatal error: Uncaught TypeError: Argument 1 passed to Ref\C::__construct() must be an instance of ReflectionClass, none given in /in/2pmPY:43
Stack trace:
#0 [internal function]: Ref\C->__construct()
#1 /in/2pmPY(57): ReflectionClass->newInstance()
#2 {main}
thrown in /in/2pmPY on line 43
Process exited with code 255.
bool(true)
bool(true)
bool(true)
bool(true)
Catchable fatal error: Argument 1 passed to Ref\C::__construct() must be an instance of ReflectionClass, none given in /in/2pmPY on line 43
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/2pmPY on line 5
Process exited with code 255.