- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- string(11) "control foo" string(11) "control foo"
<?php
trait SmartObject {
public function __call(string $name, array $args) {
return 'smart ' . $name;
}
}
class Component {
use SmartObject;
}
class FormControl extends Component {
public function __call(string $name, array $args): mixed {
return 'control ' . $name;
}
}
class CustomFormControl extends FormControl {
//use SmartObject;
}
var_dump((new FormControl)->foo());
var_dump((new CustomFormControl)->foo());