<?php
trait CtorTrait
{
protected $a;
public function __construct($a)
{
$this->a = $a;
}
}
class Test
{
use CtorTrait;
public function testTrait()
{
echo $this->a;
}
}
$test = new Test('Trait works');
$test->testTrait();
$method = new ReflectionMethod(Test::class, '__construct');
var_dump($method->getParameters());
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/jbVTU on line 22
Process exited with code 255.