<?php
namespace A {
class T {}
}
namespace {
class Test
{
public function first(string $str) : Closure
{
return function() use ($str) : int {
return strlen($str);
};
}
public function second(): self
{
return $this;
}
}
$t = new Test;
echo ($t->second()->first("hello"))();
}
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
5
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/f3Qvn on line 10
Process exited with code 255.