3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface ServerRequestInterface {} interface ResponseInterface {} interface MiddlewareInterface { public function __invoke(ServerRequestInterface $request, ResponseInterface $response, MiddlewareInterface $next = null): ResponseInterface; } $app = new class { public function pipe() {} }; $app->pipe(new class implements MiddlewareInterface { public function __invoke(ServerRequestInterface $request, ResponseInterface $response, MiddlewareInterface $next = null) { // } });
based on EcdDa
Output for 7.1.0 - 7.2.0
Fatal error: Declaration of class@anonymous::__invoke(ServerRequestInterface $request, ResponseInterface $response, ?MiddlewareInterface $next = NULL) must be compatible with MiddlewareInterface::__invoke(ServerRequestInterface $request, ResponseInterface $response, ?MiddlewareInterface $next = NULL): ResponseInterface in /in/EcsTk on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Declaration of class@anonymous::__invoke(ServerRequestInterface $request, ResponseInterface $response, MiddlewareInterface $next = NULL) must be compatible with MiddlewareInterface::__invoke(ServerRequestInterface $request, ResponseInterface $response, MiddlewareInterface $next = NULL): ResponseInterface in /in/EcsTk on line 15
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/EcsTk on line 8
Process exited with code 255.