<?php
class CanNotSetProperties extends BadMethodCallException {
}
trait Immutable {
public function __set($property, $value) {
throw new CanNotSetProperties;
}
}
final class Test {
use Immutable;
public function __construct()
{
echo 'hello';
}
}
$test = new Test;
$test->__construct();