<?php
trait Foo
{
public function foo($callback)
{
$callback();
}
}
class Bar
{
use Foo;
public function bar()
{
$this->foo(function() {
$this->baz();
});
}
protected function baz()
{
echo 'made it';
}
}
$bar = new Bar;
$bar->bar();
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
made it
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in /in/ig0mv on line 11
made itmade it