<?php
declare(strict_types=1);
interface Identity
{
/**
* Named c
*
* @param string $identifier
* @return self
*/
public static function createIdentity(): Identity;
}
class A implements Identity {
public static function createIdentity(): Identity {
return new self;
}
}
$a = A::createIdentity();
var_dump($a);
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
object(A)#1 (0) {
}
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: Unsupported declare 'strict_types' in /in/P5RYi on line 3
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/P5RYi on line 13
Process exited with code 255.